brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 9fd7052 Raw
208 lines · plain
1llvm-strip - object stripping tool2==================================3 4.. program:: llvm-strip5 6SYNOPSIS7--------8 9:program:`llvm-strip` [*options*] *inputs...*10 11DESCRIPTION12-----------13 14:program:`llvm-strip` is a tool to strip sections and symbols from object files.15If no other stripping or remove options are specified, :option:`--strip-all`16will be enabled.17 18By default, the input files are modified in-place. If "-" is specified for the19input file, the input is read from the program's standard input stream.20 21If the input is an archive, any requested operations will be applied to each22archive member individually.23 24The tool is still in active development, but in most scenarios it works as a25drop-in replacement for GNU's :program:`strip`.26 27GENERIC AND CROSS-PLATFORM OPTIONS28----------------------------------29 30The following options are either agnostic of the file format, or apply to31multiple file formats.32 33.. option:: --disable-deterministic-archives, -U34 35 Use real values for UIDs, GIDs and timestamps when updating archive member36 headers.37 38.. option:: --discard-all, -x39 40 Remove most local symbols not referenced by relocations from the output.41 Different file formats may limit this to a subset of the local symbols. For42 example, file and section symbols in ELF objects will not be discarded.43 Additionally, remove all debug sections.44 45.. option::  --enable-deterministic-archives, -D46 47 Enable deterministic mode when stripping archives, i.e. use 0 for archive member48 header UIDs, GIDs and timestamp fields. On by default.49 50.. option:: --help, -h51 52 Print a summary of command line options.53 54.. option::  --no-strip-all55 56 Disable :option:`--strip-all`.57 58.. option::  -o <file>59 60 Write output to <file>. Multiple input files cannot be used in combination61 with -o.62 63.. option:: --only-keep-debug64 65 Produce a debug file as the output that only preserves contents of sections66 useful for debugging purposes.67 68 For ELF objects, this removes the contents of `SHF_ALLOC` sections that are not69 `SHT_NOTE` by making them `SHT_NOBITS` and shrinking the program headers where70 possible.71 72.. option:: --regex73 74 If specified, symbol and section names specified by other switches are treated75 as extended POSIX regular expression patterns.76 77.. option:: --remove-section <section>, -R78 79 Remove the specified section from the output. Can be specified multiple times80 to remove multiple sections simultaneously.81 82.. option:: --strip-all-gnu83 84 Remove all symbols, debug sections and relocations from the output. This option85 is equivalent to GNU :program:`strip`'s ``--strip-all`` switch.86 87.. option:: --strip-all, -s88 89 For ELF objects, remove from the output all symbols and non-alloc sections not90 within segments, except for .gnu.warning, .ARM.attribute sections and the91 section name table.92 93 For COFF objects, remove all symbols, debug sections, and relocations from the94 output.95 96.. option:: --strip-debug, -d, -g, -S97 98 Remove all debug sections from the output.99 100.. option:: --strip-symbol <symbol>, -N101 102 Remove all symbols named ``<symbol>`` from the output. Can be specified103 multiple times to remove multiple symbols.104 105.. option:: --strip-unneeded106 107 Remove from the output all local or undefined symbols that are not required by108 relocations. Also remove all debug sections.109 110.. option:: --version, -V111 112 Display the version of the :program:`llvm-strip` executable.113 114.. option:: --wildcard, -w115 116  Allow wildcard syntax for symbol-related flags. On by default for117  section-related flags. Incompatible with --regex.118 119  Wildcard syntax allows the following special symbols:120 121  ====================== ========================= ==================122   Character              Meaning                   Equivalent123  ====================== ========================= ==================124  ``*``                  Any number of characters  ``.*``125  ``?``                  Any single character      ``.``126  ``\``                  Escape the next character ``\``127  ``[a-z]``              Character class           ``[a-z]``128  ``[!a-z]``, ``[^a-z]`` Negated character class   ``[^a-z]``129  ====================== ========================= ==================130 131  Additionally, starting a wildcard with '!' will prevent a match, even if132  another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols133  except for ``x``.134 135  The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is136  the same as ``-w -N '!x' -N '*'``.137 138.. option:: @<FILE>139 140 Read command-line options and commands from response file `<FILE>`.141 142ELF-SPECIFIC OPTIONS143--------------------144 145The following options are implemented only for ELF objects. If used with other146objects, :program:`llvm-strip` will either emit an error or silently ignore147them.148 149.. option:: --allow-broken-links150 151 Allow :program:`llvm-strip` to remove sections even if it would leave invalid152 section references. Any invalid sh_link fields will be set to zero.153 154.. option:: --discard-locals, -X155 156 Remove local symbols starting with ".L" not referenced by relocations from the output.157 158.. option:: --keep-file-symbols159 160 Keep symbols of type `STT_FILE`, even if they would otherwise be stripped.161 162.. option:: --keep-section <section>163 164 When removing sections from the output, do not remove sections named165 ``<section>``. Can be specified multiple times to keep multiple sections.166 167.. option:: --keep-symbol <symbol>, -K168 169 When removing symbols from the output, do not remove symbols named170 ``<symbol>``. Can be specified multiple times to keep multiple symbols.171 172.. option::  --preserve-dates, -p173 174 Preserve access and modification timestamps in the output.175 176.. option:: --strip-sections177 178 Remove from the output all section headers and all section data not within179 segments. Note that many tools will not be able to use an object without180 section headers.181 182MACH-O-SPECIFIC OPTIONS183-----------------------184 185The following options are implemented only for Mach-O objects. If used with other186objects, :program:`llvm-strip` will either emit an error or silently ignore187them.188 189.. option:: -T190 191 Remove Swift symbols.192 193EXIT STATUS194-----------195 196:program:`llvm-strip` exits with a non-zero exit code if there is an error.197Otherwise, it exits with code 0.198 199BUGS200----201 202To report bugs, please visit <https://github.com/llvm/llvm-project/labels/tools:llvm-objcopy%2Fstrip>.203 204SEE ALSO205--------206 207:manpage:`llvm-objcopy(1)`208