[llvm-objcopy] Add support for --only-keep/-j and --keep
authorJake Ehrlich <jakehehrlich@google.com>
Thu, 30 Nov 2017 20:14:53 +0000 (20:14 +0000)
committerJake Ehrlich <jakehehrlich@google.com>
Thu, 30 Nov 2017 20:14:53 +0000 (20:14 +0000)
commitef3b80c57ba7c1c910a1d31548cf51f630913a04
treef32acad3ac4138b7e3e367d4d4fe492b2094026d
parentaef1dfc690adc6478efcd059bdbb65d0195082b8
[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
14 files changed:
llvm/test/tools/llvm-objcopy/basic-keep.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/basic-only-keep.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/dump-section.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/explicit-keep-remove.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/explicit-only-keep-remove.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/keep-many.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/keep-only-keep.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/only-keep-many.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/only-keep-remove-strtab.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/only-keep-strip-non-alloc.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/strip-sections-keep.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/strip-sections-only-keep.test [new file with mode: 0644]
llvm/tools/llvm-objcopy/Object.h
llvm/tools/llvm-objcopy/llvm-objcopy.cpp