objcopy/strip: Allow section patterns starting with '!'.
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 24 Aug 2015 12:02:39 +0000 (13:02 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 14 Jul 2016 10:32:48 +0000 (11:32 +0100)
commite511c9b19faec4d21aef49d12224316dea3d51eb
tree8709243de73a47b67633070aca6293ba0e1949f2
parent7df94786e4723ba93d8982e55fc5e652b4b80142
objcopy/strip: Allow section patterns starting with '!'.

For symbol matching, prefixing a pattern with '!' will indicate a
non-matching pattern, however, this is not the case for section
patterns.  As a result it is not possible to say "apply this action to
all sections except ...".

With this commit the objcopy and strip tools now support '!' prefix for
section patterns, so we can say:

  objcopy --remove-section="*" --remove-section="!.text*"

Which will remove all sections, except those matching the pattern
'.text*'.

binutils/ChangeLog:

* objcopy.c (find_section_list): Handle section patterns starting
with '!' being a non-matching pattern.
* doc/binutils.texi (objcopy): Give example of using '!' with
--remove-section and --only-section.
(strip): Give example of using '!' with --remove-section.
* testsuite/binutils-all/data-sections.s: New file.
* testsuite/binutils-all/only-section-01.d: New file.
* testsuite/binutils-all/remove-section-01.d: New file.
* testsuite/binutils-all/objcopy.exp: Run new tests.
* NEWS: Mention new feature.
binutils/ChangeLog
binutils/NEWS
binutils/doc/binutils.texi
binutils/objcopy.c
binutils/testsuite/binutils-all/data-sections.s [new file with mode: 0644]
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/only-section-01.d [new file with mode: 0644]
binutils/testsuite/binutils-all/remove-section-01.d [new file with mode: 0644]
This page took 0.024391 seconds and 4 git commands to generate.