From dff604a75fe8cc500bdf8b6d037d2977f9230c2e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 10 Mar 1995 18:13:31 +0000 Subject: [PATCH] * objcopy.c (strip_options): Add --keep-symbol. (copy_options): Likewise. (copy_usage): Mention --keep-symbol and -K. (strip_usage): Likewise. (keep_symbols): New static variable. (is_strip_symbol): Adjust the return value according to keep_symbols. (strip_main): Handle -K. For -N, check that -K was not given. (copy_main): Likewise. * binutils.texi, objcopy.1, strip.1: Document -K. --- binutils/binutils.texi | 24 ++++++++++++++++++------ binutils/objcopy.1 | 27 ++++++++++++++++----------- binutils/strip.1 | 35 ++++++++++++++++++++++++----------- 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/binutils/binutils.texi b/binutils/binutils.texi index bbf2463aacd..d4dc72a4fdc 100644 --- a/binutils/binutils.texi +++ b/binutils/binutils.texi @@ -743,6 +743,7 @@ objcopy [ -F @var{bfdname} | --target=@var{bfdname} ] [ -I @var{bfdname} | --input-target=@var{bfdname} ] [ -O @var{bfdname} | --output-target=@var{bfdname} ] [ -S | --strip-all ] [ -g | --strip-debug ] + [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] [ -x | --discard-all ] [ -X | --discard-locals ] [ -b @var{byte} | --byte=@var{byte} ] @@ -824,11 +825,16 @@ Do not copy relocation and symbol information from the source file. @itemx --strip-debug Do not copy debugging symbols from the source file. +@item -K @var{symbolname} +@itemx --keep-symbol=@var{symbolname} +Copy only symbol @var{symbolname} from the source file. This option may +be given more than once. + @item -N @var{symbolname} @itemx --strip-symbol=@var{symbolname} -Do not copy symbol @var{symbolname} from the source file. This option -may be given more than once, and may be combined with other strip -options. +Do not copy symbol @var{symbolname} from the source file. This option +may be given more than once, and may be combined with strip options +other than @code{-K}. @item -x @itemx --discard-all @@ -1319,6 +1325,7 @@ strip [ -F @var{bfdname} | --target=@var{bfdname} | --target=@var{bfdname} ] [ -I @var{bfdname} | --input-target=@var{bfdname} ] [ -O @var{bfdname} | --output-target=@var{bfdname} ] [ -s | --strip-all ] [ -S | -g | --strip-debug ] + [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] [ -x | --discard-all ] [ -X | --discard-locals ] [ -R @var{sectionname} | --remove-section=@var{sectionname} ] @@ -1369,11 +1376,16 @@ Remove all symbols. @itemx --strip-debug Remove debugging symbols only. +@item -K @var{symbolname} +@itemx --keep-symbol=@var{symbolname} +Keep only symbol @var{symbolname} from the source file. This option may +be given more than once. + @item -N @var{symbolname} @itemx --strip-symbol=@var{symbolname} -Remove symbol @var{symbolname} from the source file. This option -may be given more than once, and may be combined with other strip -options. +Remove symbol @var{symbolname} from the source file. This option may be +given more than once, and may be combined with strip options other than +@code{-K}. @item -x @itemx --discard-all diff --git a/binutils/objcopy.1 b/binutils/objcopy.1 index a8c47f9f29e..15cebb06d5d 100644 --- a/binutils/objcopy.1 +++ b/binutils/objcopy.1 @@ -15,15 +15,16 @@ objcopy \- copy and translate object files .na .TP .B objcopy -.RB "[\|" \-F\ \fIbfdname\fB\ |\ \-\-target=\fIbfdname\fR "\|]" -.RB "[\|" \-I\ \fIbfdname\fB\ |\ \-\-input\-target=\fIbfdname\fR "\|]" -.RB "[\|" \-O\ \fIbfdname\fB\ |\ \-\-output\-target=\fIbfdname\fR "\|]" -.RB "[\|" \-R\ \fIsectionname\fB\ |\ \-\-remove\-section=\fIsectionname\fR "\|]" -.RB "[\|" \-S\ |\ \-\-strip\-all\fR "\|]" -.RB "[\|" \-g\ |\ \-\-strip\-debug\fR "\|]" -.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \-\-strip\-symbol=\fIsymbolname\fR "\|]" -.RB "[\|" \-x\ |\ \-\-discard\-all\fR "\|]" -.RB "[\|" \-X\ |\ \-\-discard\-locals\fR "\|]" +.RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fR "\|]" +.RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fR "\|]" +.RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fR "\|]" +.RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fR "\|]" +.RB "[\|" \-S\fR\ |\ \fB\-\-strip\-all\fR "\|]" +.RB "[\|" \-g\fR\ |\ \fB\-\-strip\-debug\fR "\|]" +.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]" +.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]" +.RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all\fR "\|]" +.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals\fR "\|]" .RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]" .RB "[\|" \-i\ \fIinterleave\fR\ |\ \fB\-\-interleave=\fIinterleave\fR "\|]" .RB "[\|" \-\-gap\-fill=\fIval\fR "\|]" @@ -123,10 +124,14 @@ Do not copy relocation and symbol information from the source file. .B \-g\fR, \fB\-\-strip\-debug Do not copy debugging symbols from the source file. .TP +.B \-K \fIsymbolname\fR, \fB\-\-keep\-symbol=\fIsymbolname +Copy only symbol \fIsymbolname\fP from the source file. This option +may be given more than once. +.TP .B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname Do not copy symbol \fIsymbolname\fP from the source file. This option -may be given more than once, and may be combined with other strip -options. +may be given more than once, and may be combined with strip options +other than \fB\-K\fR. .TP .B \-x\fR, \fB \-\-discard\-all Do not copy non-global symbols from the source file. diff --git a/binutils/strip.1 b/binutils/strip.1 index e1ec592b4c0..62a3abf3037 100644 --- a/binutils/strip.1 +++ b/binutils/strip.1 @@ -15,17 +15,19 @@ strip \- Discard symbols from object files. .na .TP .B strip -.RB "[\|" \-F \fIbfdname\fP\ |\ \-\-target=\fIbfdname\fP "\|]" -.RB "[\|" \-I \fIbfdname\fP\ |\ \-\-input\-target=\fIbfdname\fP "\|]" -.RB "[\|" \-O \fIbfdname\fP\ |\ \-\-output\-target=\fIbfdname\fP "\|]" -.RB "[\|" \-R \fIsectionname\fP\ |\ \-\-remove\-section=\fIsectionname\fP "\|]" -.RB "[\|" \-s | \-\-strip\-all "\|]" -.RB "[\|" \-S | -g | \-\-strip\-debug "\|]" -.RB "[\|" \-x | \-\-discard\-all "\|]" -.RB "[\|" \-X | \-\-discard\-locals "\|]" -.RB "[\|" \-v | \-\-verbose "\|]" -.RB "[\|" \-V | \-\-version "\|]" -.RB "[\|" \-V | \-\-help "\|]" +.RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fP "\|]" +.RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fP "\|]" +.RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fP "\|]" +.RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fP "\|]" +.RB "[\|" \-s\fR\ |\ \fB\-\-strip\-all "\|]" +.RB "[\|" \-S\fR\ |\ \fB\-g\fR\ |\ \fB\-\-strip\-debug "\|]" +.RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all "\|]" +.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals "\|]" +.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]" +.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]" +.RB "[\|" \-v\fR\ |\ \fB\-\-verbose "\|]" +.RB "[\|" \-V\fR\ |\ \fB\-\-version "\|]" +.RB "[\|" \-V\fR\ |\ \fB\-\-help "\|]" .I objfile\c \&.\|.\|. @@ -110,6 +112,17 @@ Remove non-global symbols. Remove compiler-generated local symbols. (These usually start with ``L'' or ``.''.) +.TP +.B \-K \fIsymbolname\fR, \fB\-\-keep\-symbol=\fIsymbolname +Copy only symbol \fIsymbolname\fP from the source file. This option +may be given more than once. + +.TP +.B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname +Do not copy symbol \fIsymbolname\fP from the source file. This option +may be given more than once, and may be combined with strip options +other than \fB\-K\fR. + .TP .B \-v .TP -- 2.30.2