summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test
diff options
context:
space:
mode:
authorJames Henderson <jh7370@my.bristol.ac.uk>2019-03-14 10:20:27 +0000
committerJames Henderson <jh7370@my.bristol.ac.uk>2019-03-14 10:20:27 +0000
commitc03a95d46576a5de3b3c15fc5d818cf0fe66668f (patch)
tree7dcca679bff73f96b248a4203ae9f4b49a030874 /llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test
parenteea078ee165fe1d8cdc90c626d19a6cb44f21a56 (diff)
downloadbcm5719-llvm-c03a95d46576a5de3b3c15fc5d818cf0fe66668f.tar.gz
bcm5719-llvm-c03a95d46576a5de3b3c15fc5d818cf0fe66668f.zip
[llvm-objcopy]Don't implicitly strip sections in segments
This patch changes llvm-objcopy's behaviour to not strip sections that are in segments, if they otherwise would be due to a stripping operation (--strip-all, --strip-sections, --strip-non-alloc). This preserves the segment contents. It does not change the behaviour of --strip-all-gnu (although we could choose to do so), because GNU objcopy's behaviour in this case seems to be to strip the section, nor does it prevent removing of sections in segments with --remove-section (if a user REALLY wants to remove a section, we should probably let them, although I could be persuaded that warning might be appropriate). Tests have been added to show this latter behaviour. This fixes https://bugs.llvm.org/show_bug.cgi?id=41006. Reviewed by: grimar, rupprecht, jakehehrlich Differential Revision: https://reviews.llvm.org/D59293 llvm-svn: 356129
Diffstat (limited to 'llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test')
-rw-r--r--llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test b/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test
index 8db732147d3..1f082bf4734 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test
@@ -9,6 +9,10 @@ FileHeader:
Type: ET_REL
Machine: EM_X86_64
Sections:
+ - Name: non_alloc_in_segment
+ Type: SHT_PROGBITS
+ Flags: [ ]
+ Size: 4
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_ALLOC ]
@@ -18,9 +22,15 @@ Sections:
- Name: .blarg
Type: SHT_PROGBITS
Flags: [ ]
+ProgramHeaders:
+ # Use an arbitrary segment type to show that the segment type is unimportant.
+ - Type: 0x61234567
+ Sections:
+ - Section: non_alloc_in_segment
-# CHECK: SectionHeaderCount: 4
+# CHECK: SectionHeaderCount: 5
+# CHECK: Name: non_alloc_in_segment
# CHECK: Name: .bss
# CHECK: Name: .text
# CHECK: Name: .shstrtab
OpenPOWER on IntegriCloud