aboutsummaryrefslogtreecommitdiff
path: root/binutils/doc
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-08-24 13:02:39 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2016-07-14 11:32:48 +0100
commite511c9b19faec4d21aef49d12224316dea3d51eb (patch)
tree8709243de73a47b67633070aca6293ba0e1949f2 /binutils/doc
parent7df94786e4723ba93d8982e55fc5e652b4b80142 (diff)
downloadgdb-e511c9b19faec4d21aef49d12224316dea3d51eb.zip
gdb-e511c9b19faec4d21aef49d12224316dea3d51eb.tar.gz
gdb-e511c9b19faec4d21aef49d12224316dea3d51eb.tar.bz2
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.
Diffstat (limited to 'binutils/doc')
-rw-r--r--binutils/doc/binutils.texi36
1 files changed, 36 insertions, 0 deletions
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index 5a004a3..d77bc86 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -1221,6 +1221,18 @@ This option may be given more than once. Note that using this option
inappropriately may make the output file unusable. Wildcard
characters are accepted in @var{sectionpattern}.
+If the first character of @var{sectionpattern} is the exclamation
+point (!) then matching sections will not be copied, even if earlier
+use of @option{--only-section} on the same command line would
+otherwise copy it. For example:
+
+@smallexample
+ --only-section=.text.* --only-section=!.text.foo
+@end smallexample
+
+will copy all sectinos maching '.text.*' but not the section
+'.text.foo'.
+
@item -R @var{sectionpattern}
@itemx --remove-section=@var{sectionpattern}
Remove any section matching @var{sectionpattern} from the output file.
@@ -1230,6 +1242,18 @@ characters are accepted in @var{sectionpattern}. Using both the
@option{-j} and @option{-R} options together results in undefined
behaviour.
+If the first character of @var{sectionpattern} is the exclamation
+point (!) then matching sections will not be removed even if an
+earlier use of @option{--remove-section} on the same command line
+would otherwise remove it. For example:
+
+@smallexample
+ --remove-section=.text.* --remove-section=!.text.foo
+@end smallexample
+
+will remove all sections matching the pattern '.text.*', but will not
+remove the section '.text.foo'.
+
@item -S
@itemx --strip-all
Do not copy relocation and symbol information from the source file.
@@ -3021,6 +3045,18 @@ inappropriately may make the output file unusable. The wildcard
character @samp{*} may be given at the end of @var{sectionname}. If
so, then any section starting with @var{sectionname} will be removed.
+If the first character of @var{sectionpattern} is the exclamation
+point (!) then matching sections will not be removed even if an
+earlier use of @option{--remove-section} on the same command line
+would otherwise remove it. For example:
+
+@smallexample
+ --remove-section=.text.* --remove-section=!.text.foo
+@end smallexample
+
+will remove all sections matching the pattern '.text.*', but will not
+remove the section '.text.foo'.
+
@item -s
@itemx --strip-all
Remove all symbols.