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. Additionally, remove all debug sections.
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, -d, -g, -S
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       --wildcard, -w
92              Allow  wildcard  syntax  for symbol-related flags. On by default
93              for section-related flags. Incompatible with --regex.
94
95              Wildcard syntax allows the following special symbols:
96
97                    ┌───────────────┬─────────────────────┬────────────┐
98                    │Character      │ Meaning             │ Equivalent │
99                    ├───────────────┼─────────────────────┼────────────┤
100*              │ Any number of char‐ │ .*         
101                    │               │ acters              │            │
102                    ├───────────────┼─────────────────────┼────────────┤
103?              │ Any  single charac‐ │ .          
104                    │               │ ter                 │            │
105                    ├───────────────┼─────────────────────┼────────────┤
106\              │ Escape   the   next │ \          
107                    │               │ character           │            │
108                    ├───────────────┼─────────────────────┼────────────┤
109[a-z]          │ Character class     │ [a-z]      
110                    ├───────────────┼─────────────────────┼────────────┤
111[!a-z], [^a-z] │ Negated   character │ [^a-z]     
112                    │               │ class               │            │
113                    └───────────────┴─────────────────────┴────────────┘
114
115              Additionally, starting a wildcard with '!' will prevent a match,
116              even if another flag matches. For example -w -N '*' -N '!x' will
117              strip all symbols except for x.
118
119              The order of wildcards does not matter. For example, -w  -N  '*'
120              -N '!x' is the same as -w -N '!x' -N '*'.
121
122       @<FILE>
123              Read  command-line  options  and  commands  from  response  file
124              <FILE>.
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
170       -T     Remove Swift symbols.
171

EXIT STATUS

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

BUGS

177       To         report         bugs,         please         visit         <‐
178       https://github.com/llvm/llvm-project/labels/tools:llvm-obj‐
179       copy%2Fstrip>.
180

SEE ALSO

182       llvm-objcopy(1)
183

AUTHOR

185       Maintained by the LLVM Team (https://llvm.org/).
186
188       2003-2023, LLVM Project
189
190
191
192
19314                                2023-01-19                     LLVM-STRIP(1)
Impressum