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       --only-keep-debug
56              Produce  a debug file as the output that only preserves contents
57              of sections useful for debugging purposes.
58
59              For ELF objects, this removes the contents of SHF_ALLOC sections
60              that  are  not  SHT_NOTE by making them SHT_NOBITS and shrinking
61              the program headers where possible.
62
63       --regex
64              If specified,  symbol  and  section  names  specified  by  other
65              switches  are  treated as extended POSIX regular expression pat‐
66              terns.
67
68       --remove-section <section>, -R
69              Remove the specified section from the output. Can  be  specified
70              multiple times to remove multiple sections simultaneously.
71
72       --strip-all-gnu
73              Remove all symbols, debug sections and relocations from the out‐
74              put. This  option  is  equivalent  to  GNU  strip's  --strip-all
75              switch.
76
77       --strip-all, -s
78              For  ELF objects, remove from the output all symbols and non-al‐
79              loc sections  not  within  segments,  except  for  .gnu.warning,
80              .ARM.attribute sections and the section name table.
81
82              For  COFF objects, remove all symbols, debug sections, and relo‐
83              cations from the output.
84
85       --strip-debug, -d, -g, -S
86              Remove all debug sections from the output.
87
88       --strip-symbol <symbol>, -N
89              Remove all symbols named <symbol> from the output. Can be speci‐
90              fied multiple times to remove multiple symbols.
91
92       --strip-unneeded
93              Remove  from  the output all local or undefined symbols that are
94              not required by relocations. Also remove all debug sections.
95
96       --version, -V
97              Display the version of the llvm-strip executable.
98
99       --wildcard, -w
100              Allow wildcard syntax for symbol-related flags.  On  by  default
101              for section-related flags. Incompatible with --regex.
102
103              Wildcard syntax allows the following special symbols:
104
105                    ┌───────────────┬─────────────────────┬────────────┐
106                    │Character      │ Meaning             │ Equivalent │
107                    ├───────────────┼─────────────────────┼────────────┤
108*              │ Any number of char‐ │ .*         
109                    │               │ acters              │            │
110                    ├───────────────┼─────────────────────┼────────────┤
111?              │ Any single  charac‐ │ .          
112                    │               │ ter                 │            │
113                    ├───────────────┼─────────────────────┼────────────┤
114\              │ Escape   the   next │ \          
115                    │               │ character           │            │
116                    ├───────────────┼─────────────────────┼────────────┤
117[a-z]          │ Character class     │ [a-z]      
118                    ├───────────────┼─────────────────────┼────────────┤
119[!a-z], [^a-z] │ Negated   character │ [^a-z]     
120                    │               │ class               │            │
121                    └───────────────┴─────────────────────┴────────────┘
122
123              Additionally, starting a wildcard with '!' will prevent a match,
124              even if another flag matches. For example -w -N '*' -N '!x' will
125              strip all symbols except for x.
126
127              The  order  of wildcards does not matter. For example, -w -N '*'
128              -N '!x' is the same as -w -N '!x' -N '*'.
129
130       @<FILE>
131              Read  command-line  options  and  commands  from  response  file
132              <FILE>.
133

ELF-SPECIFIC OPTIONS

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

EXIT STATUS

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

BUGS

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

SEE ALSO

181       llvm-objcopy(1)
182

AUTHOR

184       Maintained by the LLVM Team (https://llvm.org/).
185
187       2003-2023, LLVM Project
188
189
190
191
19216                                2023-08-24                     LLVM-STRIP(1)
Impressum