Implement objcopy/strip --keep-section=<sectionpattern>
authorFāng-ruì Sòng <maskray@google.com>
Fri, 1 Nov 2019 21:47:55 +0000 (14:47 -0700)
committerAlan Modra <amodra@gmail.com>
Mon, 4 Nov 2019 01:25:28 +0000 (11:55 +1030)
commit64f52b3ec1853d14293d5a461d7abc8bde5e3f62
treec51b92c5e9a8c8cb49eed60c703e817a1f3aa248
parent5e874de30bb9e50ac7401f028e3c64e282854d2e
Implement objcopy/strip --keep-section=<sectionpattern>

llvm-objcopy and llvm-strip support an option --keep-section that
keeps some sections from being removed.

* objcopy.c (enum option_values): Add OPTION_KEEP_SECTION.
(SECTION_CONTEXT_KEEP): Define.  Adjust other SECTION_CONTEXT macros.
(copy_usage): Describe --keep-section.
(strip_usage): Likewise.
(copy_main): Handle SECTION_CONTEXT_KEEP.
(strip_main): Likewise.
(is_strip_section_1): Likewise.
* testsuite/binutils-all/objcopy.exp: Add tests.
* testsuite/binutils-all/keep-section-1.d: New test driver file.
* testsuite/binutils-all/keep-section-2.d: Likewise.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.
binutils/ChangeLog
binutils/NEWS
binutils/doc/binutils.texi
binutils/objcopy.c
binutils/testsuite/binutils-all/keep-section-1.d [new file with mode: 0644]
binutils/testsuite/binutils-all/keep-section-2.d [new file with mode: 0644]
binutils/testsuite/binutils-all/objcopy.exp