1STRIP(1)                     GNU Development Tools                    STRIP(1)
2
3
4

NAME

6       strip - Discard symbols from object files.
7

SYNOPSIS

9       strip [-F bfdname |--target=bfdname]
10             [-I bfdname |--input-target=bfdname]
11             [-O bfdname |--output-target=bfdname]
12             [-s|--strip-all]
13             [-S|-g|-d|--strip-debug]
14             [-K symbolname |--keep-symbol=symbolname]
15             [-N symbolname |--strip-symbol=symbolname]
16             [-w|--wildcard]
17             [-x|--discard-all] [-X |--discard-locals]
18             [-R sectionname |--remove-section=sectionname]
19             [-o file] [-p|--preserve-dates]
20             [--keep-file-symbols]
21             [--only-keep-debug]
22             [-v |--verbose] [-V|--version]
23             [--help] [--info]
24             objfile...
25

DESCRIPTION

27       GNU strip discards all symbols from object files objfile.  The list of
28       object files may include archives.  At least one object file must be
29       given.
30
31       strip modifies the files named in its argument, rather than writing
32       modified copies under different names.
33

OPTIONS

35       -F bfdname
36       --target=bfdname
37           Treat the original objfile as a file with the object code format
38           bfdname, and rewrite it in the same format.
39
40       --help
41           Show a summary of the options to strip and exit.
42
43       --info
44           Display a list showing all architectures and object formats
45           available.
46
47       -I bfdname
48       --input-target=bfdname
49           Treat the original objfile as a file with the object code format
50           bfdname.
51
52       -O bfdname
53       --output-target=bfdname
54           Replace objfile with a file in the output format bfdname.
55
56       -R sectionname
57       --remove-section=sectionname
58           Remove any section named sectionname from the output file.  This
59           option may be given more than once.  Note that using this option
60           inappropriately may make the output file unusable.
61
62       -s
63       --strip-all
64           Remove all symbols.
65
66       -g
67       -S
68       -d
69       --strip-debug
70           Remove debugging symbols only.
71
72       --strip-unneeded
73           Remove all symbols that are not needed for relocation processing.
74
75       -K symbolname
76       --keep-symbol=symbolname
77           When stripping symbols, keep symbol symbolname even if it would
78           normally be stripped.  This option may be given more than once.
79
80       -N symbolname
81       --strip-symbol=symbolname
82           Remove symbol symbolname from the source file. This option may be
83           given more than once, and may be combined with strip options other
84           than -K.
85
86       -o file
87           Put the stripped output in file, rather than replacing the existing
88           file.  When this argument is used, only one objfile argument may be
89           specified.
90
91       -p
92       --preserve-dates
93           Preserve the access and modification dates of the file.
94
95       -w
96       --wildcard
97           Permit regular expressions in symbolnames used in other command
98           line options.  The question mark (?), asterisk (*), backslash (\)
99           and square brackets ([]) operators can be used anywhere in the
100           symbol name.  If the first character of the symbol name is the
101           exclamation point (!) then the sense of the switch is reversed for
102           that symbol.  For example:
103
104                     -w -K !foo -K fo*
105
106           would cause strip to only keep symbols that start with the letters
107           "fo", but to discard the symbol "foo".
108
109       -x
110       --discard-all
111           Remove non-global symbols.
112
113       -X
114       --discard-locals
115           Remove compiler-generated local symbols.  (These usually start with
116           L or ..)
117
118       --keep-file-symbols
119           When stripping a file, perhaps with --strip-debug or
120           --strip-unneeded, retain any symbols specifying source file names,
121           which would otherwise get stripped.
122
123       --only-keep-debug
124           Strip a file, removing contents of any sections that would not be
125           stripped by --strip-debug and leaving the debugging sections
126           intact.  In ELF files, this preserves all note sections in the
127           output.
128
129           The intention is that this option will be used in conjunction with
130           --add-gnu-debuglink to create a two part executable.  One a
131           stripped binary which will occupy less space in RAM and in a
132           distribution and the second a debugging information file which is
133           only needed if debugging abilities are required.  The suggested
134           procedure to create these files is as follows:
135
136           1.<Link the executable as normal.  Assuming that is is called>
137               "foo" then...
138
139           1.<Run "objcopy --only-keep-debug foo foo.dbg" to>
140               create a file containing the debugging info.
141
142           1.<Run "objcopy --strip-debug foo" to create a>
143               stripped executable.
144
145           1.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
146               to add a link to the debugging info into the stripped
147               executable.
148
149           Note---the choice of ".dbg" as an extension for the debug info file
150           is arbitrary.  Also the "--only-keep-debug" step is optional.  You
151           could instead do this:
152
153           1.<Link the executable as normal.>
154           1.<Copy "foo" to "foo.full">
155           1.<Run "strip --strip-debug foo">
156           1.<Run "objcopy --add-gnu-debuglink=foo.full foo">
157
158           i.e., the file pointed to by the --add-gnu-debuglink can be the
159           full executable.  It does not have to be a file created by the
160           --only-keep-debug switch.
161
162           Note---this switch is only intended for use on fully linked files.
163           It does not make sense to use it on object files where the
164           debugging information may be incomplete.  Besides the gnu_debuglink
165           feature currently only supports the presence of one filename
166           containing debugging information, not multiple filenames on a one-
167           per-object-file basis.
168
169       -V
170       --version
171           Show the version number for strip.
172
173       -v
174       --verbose
175           Verbose output: list all object files modified.  In the case of
176           archives, strip -v lists all members of the archive.
177
178       @file
179           Read command-line options from file.  The options read are inserted
180           in place of the original @file option.  If file does not exist, or
181           cannot be read, then the option will be treated literally, and not
182           removed.
183
184           Options in file are separated by whitespace.  A whitespace
185           character may be included in an option by surrounding the entire
186           option in either single or double quotes.  Any character (including
187           a backslash) may be included by prefixing the character to be
188           included with a backslash.  The file may itself contain additional
189           @file options; any such options will be processed recursively.
190

SEE ALSO

192       the Info entries for binutils.
193
195       Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
196       2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
197       Software Foundation, Inc.
198
199       Permission is granted to copy, distribute and/or modify this document
200       under the terms of the GNU Free Documentation License, Version 1.3 or
201       any later version published by the Free Software Foundation; with no
202       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
203       Texts.  A copy of the license is included in the section entitled "GNU
204       Free Documentation License".
205
206
207
208binutils-2.20                     2009-10-16                          STRIP(1)
Impressum