1STRIP(1) GNU Development Tools STRIP(1)
2
3
4
6 strip - Discard symbols from object files.
7
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 [--only-keep-debug]
21 [-v ⎪--verbose] [-V⎪--version]
22 [--help] [--info]
23 objfile...
24
26 GNU strip discards all symbols from object files objfile. The list of
27 object files may include archives. At least one object file must be
28 given.
29
30 strip modifies the files named in its argument, rather than writing
31 modified copies under different names.
32
34 -F bfdname
35 --target=bfdname
36 Treat the original objfile as a file with the object code format
37 bfdname, and rewrite it in the same format.
38
39 --help
40 Show a summary of the options to strip and exit.
41
42 --info
43 Display a list showing all architectures and object formats avail‐
44 able.
45
46 -I bfdname
47 --input-target=bfdname
48 Treat the original objfile as a file with the object code format
49 bfdname.
50
51 -O bfdname
52 --output-target=bfdname
53 Replace objfile with a file in the output format bfdname.
54
55 -R sectionname
56 --remove-section=sectionname
57 Remove any section named sectionname from the output file. This
58 option may be given more than once. Note that using this option
59 inappropriately may make the output file unusable.
60
61 -s
62 --strip-all
63 Remove all symbols.
64
65 -g
66 -S
67 -d
68 --strip-debug
69 Remove debugging symbols only.
70
71 --strip-unneeded
72 Remove all symbols that are not needed for relocation processing.
73
74 -K symbolname
75 --keep-symbol=symbolname
76 Keep only symbol symbolname from the source file. This option may
77 be given more than once.
78
79 -N symbolname
80 --strip-symbol=symbolname
81 Remove symbol symbolname from the source file. This option may be
82 given more than once, and may be combined with strip options other
83 than -K.
84
85 -o file
86 Put the stripped output in file, rather than replacing the existing
87 file. When this argument is used, only one objfile argument may be
88 specified.
89
90 -p
91 --preserve-dates
92 Preserve the access and modification dates of the file.
93
94 -w
95 --wildcard
96 Permit regular expressions in symbolnames used in other command
97 line options. The question mark (?), asterisk (*), backslash (\)
98 and square brackets ([]) operators can be used anywhere in the sym‐
99 bol name. If the first character of the symbol name is the excla‐
100 mation point (!) then the sense of the switch is reversed for that
101 symbol. For example:
102
103 -w -K !foo -K fo*
104
105 would cause strip to only keep symbols that start with the letters
106 ``fo'', but to discard the symbol ``foo''.
107
108 -x
109 --discard-all
110 Remove non-global symbols.
111
112 -X
113 --discard-locals
114 Remove compiler-generated local symbols. (These usually start with
115 L or ..)
116
117 --only-keep-debug
118 Strip a file, removing any sections that would be stripped by
119 --strip-debug and leaving the debugging sections.
120
121 The intention is that this option will be used in conjunction with
122 --add-gnu-debuglink to create a two part executable. One a
123 stripped binary which will occupy less space in RAM and in a dis‐
124 tribution and the second a debugging information file which is only
125 needed if debugging abilities are required. The suggested proce‐
126 dure to create these files is as follows:
127
128 1.<Link the executable as normal. Assuming that is is called>
129 "foo" then...
130
131 1.<Run "objcopy --only-keep-debug foo foo.dbg" to>
132 create a file containing the debugging info.
133
134 1.<Run "objcopy --strip-debug foo" to create a>
135 stripped executable.
136
137 1.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
138 to add a link to the debugging info into the stripped exe‐
139 cutable.
140
141 Note - the choice of ".dbg" as an extension for the debug info file
142 is arbitrary. Also the "--only-keep-debug" step is optional. You
143 could instead do this:
144
145 1.<Link the executable as normal.>
146 1.<Copy "foo" to "foo.full">
147 1.<Run "strip --strip-debug foo">
148 1.<Run "objcopy --add-gnu-debuglink=foo.full foo">
149
150 ie the file pointed to by the --add-gnu-debuglink can be the full
151 executable. It does not have to be a file created by the
152 --only-keep-debug switch.
153
154 -V
155 --version
156 Show the version number for strip.
157
158 -v
159 --verbose
160 Verbose output: list all object files modified. In the case of ar‐
161 chives, strip -v lists all members of the archive.
162
164 the Info entries for binutils.
165
167 Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
168 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
169
170 Permission is granted to copy, distribute and/or modify this document
171 under the terms of the GNU Free Documentation License, Version 1.1 or
172 any later version published by the Free Software Foundation; with no
173 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
174 Texts. A copy of the license is included in the section entitled ``GNU
175 Free Documentation License''.
176
177
178
179binutils-2.15.97 2005-04-20 STRIP(1)