1LLVM-STRIP(1)                        LLVM                        LLVM-STRIP(1)
2
3
4

NAME

6       llvm-strip - object stripping tool
7

SYNOPSIS

9       llvm-strip [options] inputs...
10

DESCRIPTION

12       llvm-strip  is  a tool to strip sections and symbols from object files.
13       If no other stripping or remove options are specified, --strip-all will
14       be enabled.
15
16       By  default, the input files are modified in-place. If "-" is specified
17       for the input file, the input is read from the program's standard input
18       stream.
19
20       If the input is an archive, any requested operations will be applied to
21       each archive member individually.
22
23       The tool is still in active development, but in most scenarios it works
24       as a drop-in replacement for GNU's strip.
25

GENERIC AND CROSS-PLATFORM OPTIONS

27       The  following options are either agnostic of the file format, or apply
28       to multiple file formats.
29
30       --disable-deterministic-archives, -U
31              Use real values for UIDs, GIDs and timestamps when updating  ar‐
32              chive member headers.
33
34       --discard-all, -x
35              Remove  most  local symbols from the output. Different file for‐
36              mats may limit this to a subset of the local symbols. For  exam‐
37              ple,  file  and  section symbols in ELF objects will not be dis‐
38              carded.
39
40       --enable-deterministic-archives, -D
41              Enable deterministic mode when stripping archives,  i.e.  use  0
42              for archive member header UIDs, GIDs and timestamp fields. On by
43              default.
44
45       --help, -h
46              Print a summary of command line options.
47
48       --no-strip-all
49              Disable --strip-all.
50
51       -o <file>
52              Write output to <file>. Multiple input files cannot be  used  in
53              combination with -o.
54
55       --regex
56              If  specified,  symbol  and  section  names  specified  by other
57              switches are treated as extended POSIX regular  expression  pat‐
58              terns.
59
60       --remove-section <section>, -R
61              Remove  the  specified section from the output. Can be specified
62              multiple times to remove multiple sections simultaneously.
63
64       --strip-all-gnu
65              Remove all symbols, debug sections and relocations from the out‐
66              put.  This  option  is  equivalent  to  GNU  strip's --strip-all
67              switch.
68
69       --strip-all, -S
70              For ELF objects, remove from the output all symbols and  non-al‐
71              loc  sections  not  within  segments,  except  for .gnu.warning,
72              .ARM.attribute sections and the section name table.
73
74              For COFF objects, remove all symbols, debug sections, and  relo‐
75              cations from the output.
76
77       --strip-debug, -g
78              Remove all debug sections from the output.
79
80       --strip-symbol <symbol>, -N
81              Remove all symbols named <symbol> from the output. Can be speci‐
82              fied multiple times to remove multiple symbols.
83
84       --strip-unneeded
85              Remove from the output all local or undefined symbols  that  are
86              not required by relocations. Also remove all debug sections.
87
88       --version, -V
89              Display the version of the llvm-strip executable.
90
91       @<FILE>
92              Read  command-line  options  and  commands  from  response  file
93              <FILE>.
94
95       --wildcard, -w
96              Allow wildcard syntax for symbol-related flags.  On  by  default
97              for section-related flags. Incompatible with --regex.
98
99              Wildcard syntax allows the following special symbols:
100
101                    ┌───────────────┬─────────────────────┬────────────┐
102                    │Character      │ Meaning             │ Equivalent │
103                    ├───────────────┼─────────────────────┼────────────┤
104*              │ Any number of char‐ │ .*         
105                    │               │ acters              │            │
106                    ├───────────────┼─────────────────────┼────────────┤
107?              │ Any single  charac‐ │ .          
108                    │               │ ter                 │            │
109                    ├───────────────┼─────────────────────┼────────────┤
110\              │ Escape   the   next │ \          
111                    │               │ character           │            │
112                    ├───────────────┼─────────────────────┼────────────┤
113[a-z]          │ Character class     │ [a-z]      
114                    ├───────────────┼─────────────────────┼────────────┤
115[!a-z], [^a-z] │ Negated   character │ [^a-z]     
116                    │               │ class               │            │
117                    └───────────────┴─────────────────────┴────────────┘
118
119              Additionally, starting a wildcard with '!' will prevent a match,
120              even if another flag matches. For example -w -N '*' -N '!x' will
121              strip all symbols except for x.
122
123              The  order  of wildcards does not matter. For example, -w -N '*'
124              -N '!x' is the same as -w -N '!x' -N '*'.
125

COFF-SPECIFIC OPTIONS

127       The following options are implemented only for COFF  objects.  If  used
128       with  other  objects,  llvm-strip will either emit an error or silently
129       ignore them.
130
131       --only-keep-debug
132              Remove the contents of non-debug sections from the  output,  but
133              keep the section headers.
134

ELF-SPECIFIC OPTIONS

136       The  following  options  are  implemented only for ELF objects. If used
137       with other objects, llvm-strip will either emit an  error  or  silently
138       ignore them.
139
140       --allow-broken-links
141              Allow  llvm-strip  to remove sections even if it would leave in‐
142              valid section references. Any invalid sh_link fields will be set
143              to zero.
144
145       --discard-locals, -X
146              Remove local symbols starting with ".L" from the output.
147
148       --keep-file-symbols
149              Keep  symbols  of type STT_FILE, even if they would otherwise be
150              stripped.
151
152       --keep-section <section>
153              When removing sections from the output, do not  remove  sections
154              named  <section>. Can be specified multiple times to keep multi‐
155              ple sections.
156
157       --keep-symbol <symbol>, -K
158              When removing symbols from the output,  do  not  remove  symbols
159              named <symbol>. Can be specified multiple times to keep multiple
160              symbols.
161
162       --preserve-dates, -p
163              Preserve access and modification timestamps in the output.
164
165       --strip-sections
166              Remove from the output all section headers and all section  data
167              not  within  segments.  Note that many tools will not be able to
168              use an object without section headers.
169

EXIT STATUS

171       llvm-strip exits with a non-zero exit code if there is an error.   Oth‐
172       erwise, it exits with code 0.
173

BUGS

175       To report bugs, please visit <http://llvm.org/bugs/>.
176

SEE ALSO

178       llvm-objcopy(1)
179

AUTHOR

181       Maintained by the LLVM Team (https://llvm.org/).
182
184       2003-2021, LLVM Project
185
186
187
188
18910                                2021-07-22                     LLVM-STRIP(1)
Impressum