From ef3b80c57ba7c1c910a1d31548cf51f630913a04 Mon Sep 17 00:00:00 2001 From: Jake Ehrlich Date: Thu, 30 Nov 2017 20:14:53 +0000 Subject: [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 --- .../tools/llvm-objcopy/only-keep-strip-non-alloc.test | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test (limited to 'llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test') 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 -- cgit v1.2.3