summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test
diff options
context:
space:
mode:
authorJake Ehrlich <jakehehrlich@google.com>2017-11-30 20:14:53 +0000
committerJake Ehrlich <jakehehrlich@google.com>2017-11-30 20:14:53 +0000
commitef3b80c57ba7c1c910a1d31548cf51f630913a04 (patch)
treef32acad3ac4138b7e3e367d4d4fe492b2094026d /llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test
parentaef1dfc690adc6478efcd059bdbb65d0195082b8 (diff)
downloadbcm5719-llvm-ef3b80c57ba7c1c910a1d31548cf51f630913a04.tar.gz
bcm5719-llvm-ef3b80c57ba7c1c910a1d31548cf51f630913a04.zip
[llvm-objcopy] Add support for --only-keep/-j and --keep
This change adds support for the --only-keep option and the -j alias as well. A common use case for these being used together is to dump a specific section's data. Additionally the --keep option is added (GNU objcopy doesn't have this) to avoid removing a bunch of things. This allows people to err on the side of stripping aggressively and then to keep the specific bits that they need for their application. Differential Revision: https://reviews.llvm.org/D39021 llvm-svn: 319467
Diffstat (limited to 'llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test')
-rw-r--r--llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test b/llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test
new file mode 100644
index 00000000000..bad00228492
--- /dev/null
+++ b/llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test
@@ -0,0 +1,19 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objcopy -strip-non-alloc -only-keep=.test %t %t2
+# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .test
+ Type: SHT_PROGBITS
+ Flags: [ ]
+
+# CHECK: SectionHeaderCount: 3
+
+# CHECK: Name: .test
+# CHECK: Name: .shstrtab
OpenPOWER on IntegriCloud