comparison docs/CommandGuide/llvm-strip.rst @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents
children
comparison
equal deleted inserted replaced
134:3a76565eade5 147:c2174574ed3a
1 llvm-strip - object stripping tool
2 ==================================
3
4 .. program:: llvm-strip
5
6 SYNOPSIS
7 --------
8
9 :program:`llvm-strip` [*options*] *inputs...*
10
11 DESCRIPTION
12 -----------
13
14 :program:`llvm-strip` is a tool to strip sections and symbols from object files.
15 If no other stripping or remove options are specified, :option:`--strip-all`
16 will be enabled by default.
17
18 The input files are modified in-place. If "-" is specified for the input file,
19 the input is read from the program's standard input stream.
20
21 If the input is an archive, any requested operations will be applied to each
22 archive member individually.
23
24 The tool is still in active development, but in most scenarios it works as a
25 drop-in replacement for GNU's :program:`strip`.
26
27 GENERIC AND CROSS-PLATFORM OPTIONS
28 ----------------------------------
29
30 The following options are either agnostic of the file format, or apply to
31 multiple file formats.
32
33 .. option:: --disable-deterministic-archives, -U
34
35 Use real values for UIDs, GIDs and timestamps when updating archive member
36 headers.
37
38 .. option:: --discard-all, -x
39
40 Remove most local symbols from the output. Different file formats may limit
41 this to a subset of the local symbols. For example, file and section symbols in
42 ELF objects will not be discarded.
43
44 .. option:: --enable-deterministic-archives, -D
45
46 Enable deterministic mode when stripping archives, i.e. use 0 for archive member
47 header UIDs, GIDs and timestamp fields. On by default.
48
49 .. option:: --help, -h
50
51 Print a summary of command line options.
52
53 .. option:: --no-strip-all
54
55 Disable --strip-all.
56
57 .. option:: -o <file>
58
59 Write output to <file>. Multiple input files cannot be used in combination
60 with -o.
61
62 .. option:: --regex
63
64 If specified, symbol and section names specified by other switches are treated
65 as extended POSIX regular expression patterns.
66
67 .. option:: --remove-section <section>, -R
68
69 Remove the specified section from the output. Can be specified multiple times
70 to remove multiple sections simultaneously.
71
72 .. option:: --strip-all-gnu
73
74 Remove all symbols, debug sections and relocations from the output. This option
75 is equivalent to GNU :program:`strip`'s ``--strip-all`` switch.
76
77 .. option:: --strip-all, -S
78
79 For ELF objects, remove from the output all symbols and non-alloc sections not
80 within segments, except for .gnu.warning sections and the section name table.
81
82 For COFF objects, remove all symbols, debug sections, and relocations from the
83 output.
84
85 .. option:: --strip-debug, -g
86
87 Remove all debug sections.
88
89 .. option:: --strip-sections
90
91 Remove all section headers and all sections not in segments.
92
93 .. option:: --strip-symbol <symbol>, -N
94
95 Remove all symbols named ``<symbol>`` from the output. Can be specified
96 multiple times to remove multiple symbols.
97
98 .. option:: --strip-unneeded
99
100 Remove all local or undefined symbols that are not required by relocations.
101
102 .. option:: --version, -V
103
104 Display the version of this program.
105
106 COFF-SPECIFIC OPTIONS
107 ---------------------
108
109 The following options are implemented only for COFF objects. If used with other
110 objects, :program:`llvm-strip` will either emit an error or silently ignore
111 them.
112
113 .. option:: --only-keep-debug
114
115 Remove the contents of non-debug sections from the output, but keep the section
116 headers.
117
118 ELF-SPECIFIC OPTIONS
119 --------------------
120
121 The following options are implemented only for ELF objects. If used with other
122 objects, :program:`llvm-strip` will either emit an error or silently ignore
123 them.
124
125 .. option:: --allow-broken-links
126
127 Allow llvm-strip to remove sections even if it would leave invalid section
128 references. Any invalid sh_link fields will be set to zero.
129
130 .. option:: --discard-locals, -X
131
132 Remove local symbols starting with ".L" from the output.
133
134 .. option:: --keep-file-symbols
135
136 Keep symbols of type `STT_FILE`, even if they would otherwise be stripped.
137
138 .. option:: --keep-section <section>
139
140 When removing sections from the output, do not remove sections named
141 ``<section>``. Can be specified multiple times to keep multiple sections.
142
143 .. option:: --keep-symbol <symbol>, -K
144
145 Do not remove symbols named ``<symbol>``. Can be specified multiple times to
146 keep multiple symbols.
147
148 .. option:: --preserve-dates, -p
149
150 Preserve access and modification timestamps.
151
152
153 EXIT STATUS
154 -----------
155
156 :program:`llvm-strip` exits with a non-zero exit code if there is an error.
157 Otherwise, it exits with code 0.
158
159 BUGS
160 ----
161
162 To report bugs, please visit <http://llvm.org/bugs/>.
163
164 SEE ALSO
165 --------
166
167 :manpage:`llvm-objcopy(1)`