diff options
author | James Henderson <jh7370@my.bristol.ac.uk> | 2019-04-18 09:13:30 +0000 |
---|---|---|
committer | James Henderson <jh7370@my.bristol.ac.uk> | 2019-04-18 09:13:30 +0000 |
commit | 66a9d0f8c6c90d4235d23d190be5494f06763c57 (patch) | |
tree | 3fd82196841a8e8156164207e55f37e3ff56e412 /llvm/tools/llvm-objcopy/CopyConfig.h | |
parent | 4c994120c7cfeb011d4811b9bbe81235295f34e1 (diff) | |
download | bcm5719-llvm-66a9d0f8c6c90d4235d23d190be5494f06763c57.tar.gz bcm5719-llvm-66a9d0f8c6c90d4235d23d190be5494f06763c57.zip |
[llvm-objcopy][llvm-strip] Add switch to allow removing referenced sections
llvm-objcopy currently emits an error if a section to be removed is
referenced by another section. This is a reasonable thing to do, but is
different to GNU objcopy. We should allow users who know what they are
doing to have a way to produce the invalid ELF. This change adds a new
switch --allow-broken-links to both llvm-strip and llvm-objcopy to do
precisely that. The corresponding sh_link field is then set to 0 instead
of an error being emitted.
I cannot use llvm-readelf/readobj to test the link fields because they
emit an error if any sections, like the .dynsym, cannot be properly
loaded.
Reviewed by: rupprecht, grimar
Differential Revision: https://reviews.llvm.org/D60324
llvm-svn: 358649
Diffstat (limited to 'llvm/tools/llvm-objcopy/CopyConfig.h')
-rw-r--r-- | llvm/tools/llvm-objcopy/CopyConfig.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/CopyConfig.h b/llvm/tools/llvm-objcopy/CopyConfig.h index 8c025eb3891..fd548cc76e3 100644 --- a/llvm/tools/llvm-objcopy/CopyConfig.h +++ b/llvm/tools/llvm-objcopy/CopyConfig.h @@ -149,6 +149,7 @@ struct CopyConfig { std::function<uint64_t(uint64_t)> EntryExpr; // Boolean options + bool AllowBrokenLinks = false; bool DeterministicArchives = true; bool ExtractDWO = false; bool KeepFileSymbols = false; |