109467b48Spatrickllvm-objcopy - object copying and editing tool 209467b48Spatrick============================================== 309467b48Spatrick 409467b48Spatrick.. program:: llvm-objcopy 509467b48Spatrick 609467b48SpatrickSYNOPSIS 709467b48Spatrick-------- 809467b48Spatrick 909467b48Spatrick:program:`llvm-objcopy` [*options*] *input* [*output*] 1009467b48Spatrick 1109467b48SpatrickDESCRIPTION 1209467b48Spatrick----------- 1309467b48Spatrick 1409467b48Spatrick:program:`llvm-objcopy` is a tool to copy and manipulate objects. In basic 1509467b48Spatrickusage, it makes a semantic copy of the input to the output. If any options are 1609467b48Spatrickspecified, the output may be modified along the way, e.g. by removing sections. 1709467b48Spatrick 1809467b48SpatrickIf no output file is specified, the input file is modified in-place. If "-" is 1909467b48Spatrickspecified for the input file, the input is read from the program's standard 2009467b48Spatrickinput stream. If "-" is specified for the output file, the output is written to 2109467b48Spatrickthe standard output stream of the program. 2209467b48Spatrick 2309467b48SpatrickIf the input is an archive, any requested operations will be applied to each 2409467b48Spatrickarchive member individually. 2509467b48Spatrick 2609467b48SpatrickThe tool is still in active development, but in most scenarios it works as a 2709467b48Spatrickdrop-in replacement for GNU's :program:`objcopy`. 2809467b48Spatrick 2909467b48SpatrickGENERIC AND CROSS-PLATFORM OPTIONS 3009467b48Spatrick---------------------------------- 3109467b48Spatrick 3209467b48SpatrickThe following options are either agnostic of the file format, or apply to 3309467b48Spatrickmultiple file formats. 3409467b48Spatrick 3509467b48Spatrick.. option:: --add-gnu-debuglink <debug-file> 3609467b48Spatrick 3709467b48Spatrick Add a .gnu_debuglink section for ``<debug-file>`` to the output. 3809467b48Spatrick 3909467b48Spatrick.. option:: --add-section <section=file> 4009467b48Spatrick 4109467b48Spatrick Add a section named ``<section>`` with the contents of ``<file>`` to the 4209467b48Spatrick output. For ELF objects the section will be of type `SHT_NOTE`, if the name 4309467b48Spatrick starts with ".note". Otherwise, it will have type `SHT_PROGBITS`. Can be 4409467b48Spatrick specified multiple times to add multiple sections. 4509467b48Spatrick 4609467b48Spatrick For MachO objects, ``<section>`` must be formatted as 4709467b48Spatrick ``<segment name>,<section name>``. 4809467b48Spatrick 4909467b48Spatrick.. option:: --binary-architecture <arch>, -B 5009467b48Spatrick 5109467b48Spatrick Ignored for compatibility. 5209467b48Spatrick 5309467b48Spatrick.. option:: --disable-deterministic-archives, -U 5409467b48Spatrick 5509467b48Spatrick Use real values for UIDs, GIDs and timestamps when updating archive member 5609467b48Spatrick headers. 5709467b48Spatrick 5809467b48Spatrick.. option:: --discard-all, -x 5909467b48Spatrick 6009467b48Spatrick Remove most local symbols from the output. Different file formats may limit 6109467b48Spatrick this to a subset of the local symbols. For example, file and section symbols in 6273471bf0Spatrick ELF objects will not be discarded. Additionally, remove all debug sections. 6309467b48Spatrick 6409467b48Spatrick.. option:: --dump-section <section>=<file> 6509467b48Spatrick 6609467b48Spatrick Dump the contents of section ``<section>`` into the file ``<file>``. Can be 6709467b48Spatrick specified multiple times to dump multiple sections to different files. 6809467b48Spatrick ``<file>`` is unrelated to the input and output files provided to 6909467b48Spatrick :program:`llvm-objcopy` and as such the normal copying and editing 7009467b48Spatrick operations will still be performed. No operations are performed on the sections 7109467b48Spatrick prior to dumping them. 7209467b48Spatrick 7309467b48Spatrick For MachO objects, ``<section>`` must be formatted as 7409467b48Spatrick ``<segment name>,<section name>``. 7509467b48Spatrick 7609467b48Spatrick.. option:: --enable-deterministic-archives, -D 7709467b48Spatrick 7809467b48Spatrick Enable deterministic mode when copying archives, i.e. use 0 for archive member 7909467b48Spatrick header UIDs, GIDs and timestamp fields. On by default. 8009467b48Spatrick 8109467b48Spatrick.. option:: --help, -h 8209467b48Spatrick 8309467b48Spatrick Print a summary of command line options. 8409467b48Spatrick 8509467b48Spatrick.. option:: --only-keep-debug 8609467b48Spatrick 8709467b48Spatrick Produce a debug file as the output that only preserves contents of sections 8809467b48Spatrick useful for debugging purposes. 8909467b48Spatrick 9009467b48Spatrick For ELF objects, this removes the contents of `SHF_ALLOC` sections that are not 9109467b48Spatrick `SHT_NOTE` by making them `SHT_NOBITS` and shrinking the program headers where 9209467b48Spatrick possible. 9309467b48Spatrick 9409467b48Spatrick.. option:: --only-section <section>, -j 9509467b48Spatrick 9609467b48Spatrick Remove all sections from the output, except for sections named ``<section>``. 9709467b48Spatrick Can be specified multiple times to keep multiple sections. 9809467b48Spatrick 9909467b48Spatrick For MachO objects, ``<section>`` must be formatted as 10009467b48Spatrick ``<segment name>,<section name>``. 10109467b48Spatrick 10209467b48Spatrick.. option:: --redefine-sym <old>=<new> 10309467b48Spatrick 10409467b48Spatrick Rename symbols called ``<old>`` to ``<new>`` in the output. Can be specified 10509467b48Spatrick multiple times to rename multiple symbols. 10609467b48Spatrick 10709467b48Spatrick.. option:: --redefine-syms <filename> 10809467b48Spatrick 10909467b48Spatrick Rename symbols in the output as described in the file ``<filename>``. In the 11009467b48Spatrick file, each line represents a single symbol to rename, with the old name and new 11109467b48Spatrick name separated by whitespace. Leading and trailing whitespace is ignored, as is 11209467b48Spatrick anything following a '#'. Can be specified multiple times to read names from 11309467b48Spatrick multiple files. 11409467b48Spatrick 11509467b48Spatrick.. option:: --regex 11609467b48Spatrick 11709467b48Spatrick If specified, symbol and section names specified by other switches are treated 11809467b48Spatrick as extended POSIX regular expression patterns. 11909467b48Spatrick 12009467b48Spatrick.. option:: --remove-section <section>, -R 12109467b48Spatrick 12209467b48Spatrick Remove the specified section from the output. Can be specified multiple times 12309467b48Spatrick to remove multiple sections simultaneously. 12409467b48Spatrick 12509467b48Spatrick For MachO objects, ``<section>`` must be formatted as 12609467b48Spatrick ``<segment name>,<section name>``. 12709467b48Spatrick 12809467b48Spatrick.. option:: --set-section-alignment <section>=<align> 12909467b48Spatrick 130*d415bd75Srobert Set the alignment of section ``<section>`` to ``<align>``. Can be specified 13109467b48Spatrick multiple times to update multiple sections. 13209467b48Spatrick 133097a140dSpatrick.. option:: --set-section-flags <section>=<flag>[,<flag>,...] 134097a140dSpatrick 135097a140dSpatrick Set section properties in the output of section ``<section>`` based on the 136097a140dSpatrick specified ``<flag>`` values. Can be specified multiple times to update multiple 137097a140dSpatrick sections. 138097a140dSpatrick 139097a140dSpatrick Supported flag names are `alloc`, `load`, `noload`, `readonly`, `exclude`, 140097a140dSpatrick `debug`, `code`, `data`, `rom`, `share`, `contents`, `merge` and `strings`. Not 141097a140dSpatrick all flags are meaningful for all object file formats. 142097a140dSpatrick 143097a140dSpatrick For ELF objects, the flags have the following effects: 144097a140dSpatrick 145097a140dSpatrick - `alloc` = add the `SHF_ALLOC` flag. 146097a140dSpatrick - `load` = if the section has `SHT_NOBITS` type, mark it as a `SHT_PROGBITS` 147097a140dSpatrick section. 148097a140dSpatrick - `readonly` = if this flag is not specified, add the `SHF_WRITE` flag. 149097a140dSpatrick - `exclude` = add the `SHF_EXCLUDE` flag. 150097a140dSpatrick - `code` = add the `SHF_EXECINSTR` flag. 151097a140dSpatrick - `merge` = add the `SHF_MERGE` flag. 152097a140dSpatrick - `strings` = add the `SHF_STRINGS` flag. 153097a140dSpatrick - `contents` = if the section has `SHT_NOBITS` type, mark it as a `SHT_PROGBITS` 154097a140dSpatrick section. 155097a140dSpatrick 156097a140dSpatrick For COFF objects, the flags have the following effects: 157097a140dSpatrick 158097a140dSpatrick - `alloc` = add the `IMAGE_SCN_CNT_UNINITIALIZED_DATA` and `IMAGE_SCN_MEM_READ` 159097a140dSpatrick flags, unless the `load` flag is specified. 160097a140dSpatrick - `noload` = add the `IMAGE_SCN_LNK_REMOVE` and `IMAGE_SCN_MEM_READ` flags. 161097a140dSpatrick - `readonly` = if this flag is not specified, add the `IMAGE_SCN_MEM_WRITE` 162097a140dSpatrick flag. 163097a140dSpatrick - `exclude` = add the `IMAGE_SCN_LNK_REMOVE` and `IMAGE_SCN_MEM_READ` flags. 164097a140dSpatrick - `debug` = add the `IMAGE_SCN_CNT_INITIALIZED_DATA`, 165097a140dSpatrick `IMAGE_SCN_MEM_DISCARDABLE` and `IMAGE_SCN_MEM_READ` flags. 166097a140dSpatrick - `code` = add the `IMAGE_SCN_CNT_CODE`, `IMAGE_SCN_MEM_EXECUTE` and 167097a140dSpatrick `IMAGE_SCN_MEM_READ` flags. 168097a140dSpatrick - `data` = add the `IMAGE_SCN_CNT_INITIALIZED_DATA` and `IMAGE_SCN_MEM_READ` 169097a140dSpatrick flags. 170097a140dSpatrick - `share` = add the `IMAGE_SCN_MEM_SHARED` and `IMAGE_SCN_MEM_READ` flags. 171097a140dSpatrick 17209467b48Spatrick.. option:: --strip-all-gnu 17309467b48Spatrick 17409467b48Spatrick Remove all symbols, debug sections and relocations from the output. This option 17509467b48Spatrick is equivalent to GNU :program:`objcopy`'s ``--strip-all`` switch. 17609467b48Spatrick 17709467b48Spatrick.. option:: --strip-all, -S 17809467b48Spatrick 17909467b48Spatrick For ELF objects, remove from the output all symbols and non-alloc sections not 18009467b48Spatrick within segments, except for .gnu.warning, .ARM.attribute sections and the 18109467b48Spatrick section name table. 18209467b48Spatrick 18309467b48Spatrick For COFF and Mach-O objects, remove all symbols, debug sections, and 18409467b48Spatrick relocations from the output. 18509467b48Spatrick 18609467b48Spatrick.. option:: --strip-debug, -g 18709467b48Spatrick 18809467b48Spatrick Remove all debug sections from the output. 18909467b48Spatrick 19009467b48Spatrick.. option:: --strip-symbol <symbol>, -N 19109467b48Spatrick 19209467b48Spatrick Remove all symbols named ``<symbol>`` from the output. Can be specified 19309467b48Spatrick multiple times to remove multiple symbols. 19409467b48Spatrick 19509467b48Spatrick.. option:: --strip-symbols <filename> 19609467b48Spatrick 19709467b48Spatrick Remove all symbols whose names appear in the file ``<filename>``, from the 19809467b48Spatrick output. In the file, each line represents a single symbol name, with leading 19909467b48Spatrick and trailing whitespace ignored, as is anything following a '#'. Can be 20009467b48Spatrick specified multiple times to read names from multiple files. 20109467b48Spatrick 20209467b48Spatrick.. option:: --strip-unneeded-symbol <symbol> 20309467b48Spatrick 20409467b48Spatrick Remove from the output all symbols named ``<symbol>`` that are local or 20509467b48Spatrick undefined and are not required by any relocation. 20609467b48Spatrick 20709467b48Spatrick.. option:: --strip-unneeded-symbols <filename> 20809467b48Spatrick 20909467b48Spatrick Remove all symbols whose names appear in the file ``<filename>``, from the 21009467b48Spatrick output, if they are local or undefined and are not required by any relocation. 21109467b48Spatrick In the file, each line represents a single symbol name, with leading and 21209467b48Spatrick trailing whitespace ignored, as is anything following a '#'. Can be specified 21309467b48Spatrick multiple times to read names from multiple files. 21409467b48Spatrick 21509467b48Spatrick.. option:: --strip-unneeded 21609467b48Spatrick 21709467b48Spatrick Remove from the output all local or undefined symbols that are not required by 21809467b48Spatrick relocations. Also remove all debug sections. 21909467b48Spatrick 220*d415bd75Srobert.. option:: --update-section <name>=<file> 221*d415bd75Srobert 222*d415bd75Srobert Replace the contents of the section ``<name>`` with contents from the file 223*d415bd75Srobert ``<file>``. If the section ``<name>`` is part of a segment, the new contents 224*d415bd75Srobert cannot be larger than the existing section. 225*d415bd75Srobert 22609467b48Spatrick.. option:: --version, -V 22709467b48Spatrick 22809467b48Spatrick Display the version of the :program:`llvm-objcopy` executable. 22909467b48Spatrick 23009467b48Spatrick.. option:: --wildcard, -w 23109467b48Spatrick 23209467b48Spatrick Allow wildcard syntax for symbol-related flags. On by default for 23309467b48Spatrick section-related flags. Incompatible with --regex. 23409467b48Spatrick 23509467b48Spatrick Wildcard syntax allows the following special symbols: 23609467b48Spatrick 23709467b48Spatrick ====================== ========================= ================== 23809467b48Spatrick Character Meaning Equivalent 23909467b48Spatrick ====================== ========================= ================== 24009467b48Spatrick ``*`` Any number of characters ``.*`` 24109467b48Spatrick ``?`` Any single character ``.`` 24209467b48Spatrick ``\`` Escape the next character ``\`` 24309467b48Spatrick ``[a-z]`` Character class ``[a-z]`` 24409467b48Spatrick ``[!a-z]``, ``[^a-z]`` Negated character class ``[^a-z]`` 24509467b48Spatrick ====================== ========================= ================== 24609467b48Spatrick 24709467b48Spatrick Additionally, starting a wildcard with '!' will prevent a match, even if 24809467b48Spatrick another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols 24909467b48Spatrick except for ``x``. 25009467b48Spatrick 25109467b48Spatrick The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is 25209467b48Spatrick the same as ``-w -N '!x' -N '*'``. 25309467b48Spatrick 254097a140dSpatrick.. option:: @<FILE> 25509467b48Spatrick 256097a140dSpatrick Read command-line options and commands from response file `<FILE>`. 25709467b48Spatrick 25809467b48SpatrickELF-SPECIFIC OPTIONS 25909467b48Spatrick-------------------- 26009467b48Spatrick 26109467b48SpatrickThe following options are implemented only for ELF objects. If used with other 26209467b48Spatrickobjects, :program:`llvm-objcopy` will either emit an error or silently ignore 26309467b48Spatrickthem. 26409467b48Spatrick 26509467b48Spatrick.. option:: --add-symbol <name>=[<section>:]<value>[,<flags>] 26609467b48Spatrick 26709467b48Spatrick Add a new symbol called ``<name>`` to the output symbol table, in the section 26809467b48Spatrick named ``<section>``, with value ``<value>``. If ``<section>`` is not specified, 26909467b48Spatrick the symbol is added as an absolute symbol. The ``<flags>`` affect the symbol 27009467b48Spatrick properties. Accepted values are: 27109467b48Spatrick 27209467b48Spatrick - `global` = the symbol will have global binding. 27309467b48Spatrick - `local` = the symbol will have local binding. 27409467b48Spatrick - `weak` = the symbol will have weak binding. 27509467b48Spatrick - `default` = the symbol will have default visibility. 27609467b48Spatrick - `hidden` = the symbol will have hidden visibility. 27709467b48Spatrick - `protected` = the symbol will have protected visibility. 27809467b48Spatrick - `file` = the symbol will be an `STT_FILE` symbol. 27909467b48Spatrick - `section` = the symbol will be an `STT_SECTION` symbol. 28009467b48Spatrick - `object` = the symbol will be an `STT_OBJECT` symbol. 28109467b48Spatrick - `function` = the symbol will be an `STT_FUNC` symbol. 28209467b48Spatrick - `indirect-function` = the symbol will be an `STT_GNU_IFUNC` symbol. 28309467b48Spatrick 28409467b48Spatrick Additionally, the following flags are accepted but ignored: `debug`, 28509467b48Spatrick `constructor`, `warning`, `indirect`, `synthetic`, `unique-object`, `before`. 28609467b48Spatrick 28709467b48Spatrick Can be specified multiple times to add multiple symbols. 28809467b48Spatrick 28909467b48Spatrick.. option:: --allow-broken-links 29009467b48Spatrick 29109467b48Spatrick Allow :program:`llvm-objcopy` to remove sections even if it would leave invalid 29209467b48Spatrick section references. Any invalid sh_link fields will be set to zero. 29309467b48Spatrick 29409467b48Spatrick.. option:: --change-start <incr>, --adjust-start 29509467b48Spatrick 29609467b48Spatrick Add ``<incr>`` to the program's start address. Can be specified multiple 29709467b48Spatrick times, in which case the values will be applied cumulatively. 29809467b48Spatrick 299*d415bd75Srobert.. option:: --compress-debug-sections [<format>] 30009467b48Spatrick 301*d415bd75Srobert Compress DWARF debug sections in the output, using the specified format. 302*d415bd75Srobert Supported formats are ``zlib`` and ``zstd``. Use ``zlib`` if ``<format>`` is omitted. 30309467b48Spatrick 30409467b48Spatrick.. option:: --decompress-debug-sections 30509467b48Spatrick 30609467b48Spatrick Decompress any compressed DWARF debug sections in the output. 30709467b48Spatrick 30809467b48Spatrick.. option:: --discard-locals, -X 30909467b48Spatrick 31009467b48Spatrick Remove local symbols starting with ".L" from the output. 31109467b48Spatrick 31209467b48Spatrick.. option:: --extract-dwo 31309467b48Spatrick 31409467b48Spatrick Remove all sections that are not DWARF .dwo sections from the output. 31509467b48Spatrick 31609467b48Spatrick.. option:: --extract-main-partition 31709467b48Spatrick 31809467b48Spatrick Extract the main partition from the output. 31909467b48Spatrick 32009467b48Spatrick.. option:: --extract-partition <name> 32109467b48Spatrick 32209467b48Spatrick Extract the named partition from the output. 32309467b48Spatrick 32409467b48Spatrick.. option:: --globalize-symbol <symbol> 32509467b48Spatrick 32609467b48Spatrick Mark any defined symbols named ``<symbol>`` as global symbols in the output. 32709467b48Spatrick Can be specified multiple times to mark multiple symbols. 32809467b48Spatrick 32909467b48Spatrick.. option:: --globalize-symbols <filename> 33009467b48Spatrick 33109467b48Spatrick Read a list of names from the file ``<filename>`` and mark defined symbols with 33209467b48Spatrick those names as global in the output. In the file, each line represents a single 33309467b48Spatrick symbol, with leading and trailing whitespace ignored, as is anything following 33409467b48Spatrick a '#'. Can be specified multiple times to read names from multiple files. 33509467b48Spatrick 33609467b48Spatrick.. option:: --input-target <format>, -I 33709467b48Spatrick 33809467b48Spatrick Read the input as the specified format. See `SUPPORTED FORMATS`_ for a list of 33909467b48Spatrick valid ``<format>`` values. If unspecified, :program:`llvm-objcopy` will attempt 34009467b48Spatrick to determine the format automatically. 34109467b48Spatrick 34209467b48Spatrick.. option:: --keep-file-symbols 34309467b48Spatrick 34409467b48Spatrick Keep symbols of type `STT_FILE`, even if they would otherwise be stripped. 34509467b48Spatrick 346*d415bd75Srobert.. option:: --keep-global-symbol <symbol>, -G 34709467b48Spatrick 34809467b48Spatrick Make all symbols local in the output, except for symbols with the name 34909467b48Spatrick ``<symbol>``. Can be specified multiple times to ignore multiple symbols. 35009467b48Spatrick 35109467b48Spatrick.. option:: --keep-global-symbols <filename> 35209467b48Spatrick 35309467b48Spatrick Make all symbols local in the output, except for symbols named in the file 35409467b48Spatrick ``<filename>``. In the file, each line represents a single symbol, with leading 35509467b48Spatrick and trailing whitespace ignored, as is anything following a '#'. Can be 35609467b48Spatrick specified multiple times to read names from multiple files. 35709467b48Spatrick 35809467b48Spatrick.. option:: --keep-section <section> 35909467b48Spatrick 36009467b48Spatrick When removing sections from the output, do not remove sections named 36109467b48Spatrick ``<section>``. Can be specified multiple times to keep multiple sections. 36209467b48Spatrick 36309467b48Spatrick.. option:: --keep-symbol <symbol>, -K 36409467b48Spatrick 36509467b48Spatrick When removing symbols from the output, do not remove symbols named 36609467b48Spatrick ``<symbol>``. Can be specified multiple times to keep multiple symbols. 36709467b48Spatrick 36809467b48Spatrick.. option:: --keep-symbols <filename> 36909467b48Spatrick 37009467b48Spatrick When removing symbols from the output do not remove symbols named in the file 37109467b48Spatrick ``<filename>``. In the file, each line represents a single symbol, with leading 37209467b48Spatrick and trailing whitespace ignored, as is anything following a '#'. Can be 37309467b48Spatrick specified multiple times to read names from multiple files. 37409467b48Spatrick 37509467b48Spatrick.. option:: --localize-hidden 37609467b48Spatrick 37709467b48Spatrick Make all symbols with hidden or internal visibility local in the output. 37809467b48Spatrick 37909467b48Spatrick.. option:: --localize-symbol <symbol>, -L 38009467b48Spatrick 38109467b48Spatrick Mark any defined non-common symbol named ``<symbol>`` as a local symbol in the 38209467b48Spatrick output. Can be specified multiple times to mark multiple symbols as local. 38309467b48Spatrick 38409467b48Spatrick.. option:: --localize-symbols <filename> 38509467b48Spatrick 38609467b48Spatrick Read a list of names from the file ``<filename>`` and mark defined non-common 38709467b48Spatrick symbols with those names as local in the output. In the file, each line 38809467b48Spatrick represents a single symbol, with leading and trailing whitespace ignored, as is 38909467b48Spatrick anything following a '#'. Can be specified multiple times to read names from 39009467b48Spatrick multiple files. 39109467b48Spatrick 39209467b48Spatrick.. option:: --new-symbol-visibility <visibility> 39309467b48Spatrick 39409467b48Spatrick Specify the visibility of the symbols automatically created when using binary 39509467b48Spatrick input or :option:`--add-symbol`. Valid options are: 39609467b48Spatrick 39709467b48Spatrick - `default` 39809467b48Spatrick - `hidden` 39909467b48Spatrick - `internal` 40009467b48Spatrick - `protected` 40109467b48Spatrick 40209467b48Spatrick The default is `default`. 40309467b48Spatrick 40409467b48Spatrick.. option:: --output-target <format>, -O 40509467b48Spatrick 40609467b48Spatrick Write the output as the specified format. See `SUPPORTED FORMATS`_ for a list 40709467b48Spatrick of valid ``<format>`` values. If unspecified, the output format is assumed to 408097a140dSpatrick be the same as the value specified for :option:`--input-target` or the input 409097a140dSpatrick file's format if that option is also unspecified. 41009467b48Spatrick 41109467b48Spatrick.. option:: --prefix-alloc-sections <prefix> 41209467b48Spatrick 41309467b48Spatrick Add ``<prefix>`` to the front of the names of all allocatable sections in the 41409467b48Spatrick output. 41509467b48Spatrick 41609467b48Spatrick.. option:: --prefix-symbols <prefix> 41709467b48Spatrick 41809467b48Spatrick Add ``<prefix>`` to the front of every symbol name in the output. 41909467b48Spatrick 42009467b48Spatrick.. option:: --preserve-dates, -p 42109467b48Spatrick 42209467b48Spatrick Preserve access and modification timestamps in the output. 42309467b48Spatrick 42409467b48Spatrick.. option:: --rename-section <old>=<new>[,<flag>,...] 42509467b48Spatrick 42609467b48Spatrick Rename sections called ``<old>`` to ``<new>`` in the output, and apply any 42709467b48Spatrick specified ``<flag>`` values. See :option:`--set-section-flags` for a list of 42809467b48Spatrick supported flags. Can be specified multiple times to rename multiple sections. 42909467b48Spatrick 430*d415bd75Srobert.. option:: --set-section-type <section>=<type> 431*d415bd75Srobert 432*d415bd75Srobert Set the type of section ``<section>`` to the integer ``<type>``. Can be 433*d415bd75Srobert specified multiple times to update multiple sections. 434*d415bd75Srobert 43509467b48Spatrick.. option:: --set-start-addr <addr> 43609467b48Spatrick 43709467b48Spatrick Set the start address of the output to ``<addr>``. Overrides any previously 43809467b48Spatrick specified :option:`--change-start` or :option:`--adjust-start` options. 43909467b48Spatrick 44009467b48Spatrick.. option:: --split-dwo <dwo-file> 44109467b48Spatrick 44209467b48Spatrick Equivalent to running :program:`llvm-objcopy` with :option:`--extract-dwo` and 44309467b48Spatrick ``<dwo-file>`` as the output file and no other options, and then with 44409467b48Spatrick :option:`--strip-dwo` on the input file. 44509467b48Spatrick 44609467b48Spatrick.. option:: --strip-dwo 44709467b48Spatrick 44809467b48Spatrick Remove all DWARF .dwo sections from the output. 44909467b48Spatrick 45009467b48Spatrick.. option:: --strip-non-alloc 45109467b48Spatrick 45209467b48Spatrick Remove from the output all non-allocatable sections that are not within 45309467b48Spatrick segments. 45409467b48Spatrick 45509467b48Spatrick.. option:: --strip-sections 45609467b48Spatrick 45709467b48Spatrick Remove from the output all section headers and all section data not within 45809467b48Spatrick segments. Note that many tools will not be able to use an object without 45909467b48Spatrick section headers. 46009467b48Spatrick 46109467b48Spatrick.. option:: --target <format>, -F 46209467b48Spatrick 46309467b48Spatrick Equivalent to :option:`--input-target` and :option:`--output-target` for the 46409467b48Spatrick specified format. See `SUPPORTED FORMATS`_ for a list of valid ``<format>`` 46509467b48Spatrick values. 46609467b48Spatrick 46709467b48Spatrick.. option:: --weaken-symbol <symbol>, -W 46809467b48Spatrick 46909467b48Spatrick Mark any global symbol named ``<symbol>`` as a weak symbol in the output. Can 47009467b48Spatrick be specified multiple times to mark multiple symbols as weak. 47109467b48Spatrick 47209467b48Spatrick.. option:: --weaken-symbols <filename> 47309467b48Spatrick 47409467b48Spatrick Read a list of names from the file ``<filename>`` and mark global symbols with 47509467b48Spatrick those names as weak in the output. In the file, each line represents a single 47609467b48Spatrick symbol, with leading and trailing whitespace ignored, as is anything following 47709467b48Spatrick a '#'. Can be specified multiple times to read names from multiple files. 47809467b48Spatrick 47909467b48Spatrick.. option:: --weaken 48009467b48Spatrick 48109467b48Spatrick Mark all defined global symbols as weak in the output. 48209467b48Spatrick 48373471bf0SpatrickMACH-O-SPECIFIC OPTIONS 48473471bf0Spatrick----------------------- 48573471bf0Spatrick 48673471bf0Spatrick.. option:: --keep-undefined 48773471bf0Spatrick 48873471bf0Spatrick Keep undefined symbols, even if they would otherwise be stripped. 48973471bf0Spatrick 490*d415bd75SrobertCOFF-SPECIFIC OPTIONS 491*d415bd75Srobert--------------------- 492*d415bd75Srobert 493*d415bd75Srobert.. option:: --subsystem <name>[:<version>] 494*d415bd75Srobert 495*d415bd75Srobert Set the PE subsystem, and optionally subsystem version. 496*d415bd75Srobert 49709467b48SpatrickSUPPORTED FORMATS 49809467b48Spatrick----------------- 49909467b48Spatrick 50009467b48SpatrickThe following values are currently supported by :program:`llvm-objcopy` for the 50109467b48Spatrick:option:`--input-target`, :option:`--output-target`, and :option:`--target` 50209467b48Spatrickoptions. For GNU :program:`objcopy` compatibility, the values are all bfdnames. 50309467b48Spatrick 50409467b48Spatrick- `binary` 50509467b48Spatrick- `ihex` 50609467b48Spatrick- `elf32-i386` 50709467b48Spatrick- `elf32-x86-64` 50809467b48Spatrick- `elf64-x86-64` 50909467b48Spatrick- `elf32-iamcu` 51009467b48Spatrick- `elf32-littlearm` 51109467b48Spatrick- `elf64-aarch64` 51209467b48Spatrick- `elf64-littleaarch64` 51309467b48Spatrick- `elf32-littleriscv` 51409467b48Spatrick- `elf64-littleriscv` 51509467b48Spatrick- `elf32-powerpc` 51609467b48Spatrick- `elf32-powerpcle` 51709467b48Spatrick- `elf64-powerpc` 51809467b48Spatrick- `elf64-powerpcle` 51909467b48Spatrick- `elf32-bigmips` 52009467b48Spatrick- `elf32-ntradbigmips` 52109467b48Spatrick- `elf32-ntradlittlemips` 52209467b48Spatrick- `elf32-tradbigmips` 52309467b48Spatrick- `elf32-tradlittlemips` 52409467b48Spatrick- `elf64-tradbigmips` 52509467b48Spatrick- `elf64-tradlittlemips` 52609467b48Spatrick- `elf32-sparc` 52709467b48Spatrick- `elf32-sparcel` 52809467b48Spatrick 52909467b48SpatrickAdditionally, all targets except `binary` and `ihex` can have `-freebsd` as a 53009467b48Spatricksuffix. 53109467b48Spatrick 53209467b48SpatrickBINARY INPUT AND OUTPUT 53309467b48Spatrick----------------------- 53409467b48Spatrick 53509467b48SpatrickIf `binary` is used as the value for :option:`--input-target`, the input file 53609467b48Spatrickwill be embedded as a data section in an ELF relocatable object, with symbols 53709467b48Spatrick``_binary_<file_name>_start``, ``_binary_<file_name>_end``, and 53809467b48Spatrick``_binary_<file_name>_size`` representing the start, end and size of the data, 53909467b48Spatrickwhere ``<file_name>`` is the path of the input file as specified on the command 54009467b48Spatrickline with non-alphanumeric characters converted to ``_``. 54109467b48Spatrick 54209467b48SpatrickIf `binary` is used as the value for :option:`--output-target`, the output file 54309467b48Spatrickwill be a raw binary file, containing the memory image of the input file. 54409467b48SpatrickSymbols and relocation information will be discarded. The image will start at 54509467b48Spatrickthe address of the first loadable section in the output. 54609467b48Spatrick 54709467b48SpatrickEXIT STATUS 54809467b48Spatrick----------- 54909467b48Spatrick 55009467b48Spatrick:program:`llvm-objcopy` exits with a non-zero exit code if there is an error. 55109467b48SpatrickOtherwise, it exits with code 0. 55209467b48Spatrick 55309467b48SpatrickBUGS 55409467b48Spatrick---- 55509467b48Spatrick 556*d415bd75SrobertTo report bugs, please visit <https://github.com/llvm/llvm-project/labels/tools:llvm-objcopy/strip/>. 55709467b48Spatrick 55809467b48SpatrickThere is a known issue with :option:`--input-target` and :option:`--target` 55909467b48Spatrickcausing only ``binary`` and ``ihex`` formats to have any effect. Other values 56009467b48Spatrickwill be ignored and :program:`llvm-objcopy` will attempt to guess the input 56109467b48Spatrickformat. 56209467b48Spatrick 56309467b48SpatrickSEE ALSO 56409467b48Spatrick-------- 56509467b48Spatrick 56609467b48Spatrick:manpage:`llvm-strip(1)` 567