17330f729Sjoergllvm-objcopy - object copying and editing tool 27330f729Sjoerg============================================== 37330f729Sjoerg 47330f729Sjoerg.. program:: llvm-objcopy 57330f729Sjoerg 67330f729SjoergSYNOPSIS 77330f729Sjoerg-------- 87330f729Sjoerg 97330f729Sjoerg:program:`llvm-objcopy` [*options*] *input* [*output*] 107330f729Sjoerg 117330f729SjoergDESCRIPTION 127330f729Sjoerg----------- 137330f729Sjoerg 147330f729Sjoerg:program:`llvm-objcopy` is a tool to copy and manipulate objects. In basic 157330f729Sjoergusage, it makes a semantic copy of the input to the output. If any options are 167330f729Sjoergspecified, the output may be modified along the way, e.g. by removing sections. 177330f729Sjoerg 187330f729SjoergIf no output file is specified, the input file is modified in-place. If "-" is 197330f729Sjoergspecified for the input file, the input is read from the program's standard 207330f729Sjoerginput stream. If "-" is specified for the output file, the output is written to 217330f729Sjoergthe standard output stream of the program. 227330f729Sjoerg 237330f729SjoergIf the input is an archive, any requested operations will be applied to each 247330f729Sjoergarchive member individually. 257330f729Sjoerg 267330f729SjoergThe tool is still in active development, but in most scenarios it works as a 277330f729Sjoergdrop-in replacement for GNU's :program:`objcopy`. 287330f729Sjoerg 297330f729SjoergGENERIC AND CROSS-PLATFORM OPTIONS 307330f729Sjoerg---------------------------------- 317330f729Sjoerg 327330f729SjoergThe following options are either agnostic of the file format, or apply to 337330f729Sjoergmultiple file formats. 347330f729Sjoerg 357330f729Sjoerg.. option:: --add-gnu-debuglink <debug-file> 367330f729Sjoerg 377330f729Sjoerg Add a .gnu_debuglink section for ``<debug-file>`` to the output. 387330f729Sjoerg 397330f729Sjoerg.. option:: --add-section <section=file> 407330f729Sjoerg 417330f729Sjoerg Add a section named ``<section>`` with the contents of ``<file>`` to the 427330f729Sjoerg output. For ELF objects the section will be of type `SHT_NOTE`, if the name 437330f729Sjoerg starts with ".note". Otherwise, it will have type `SHT_PROGBITS`. Can be 447330f729Sjoerg specified multiple times to add multiple sections. 457330f729Sjoerg 46*82d56013Sjoerg For MachO objects, ``<section>`` must be formatted as 47*82d56013Sjoerg ``<segment name>,<section name>``. 48*82d56013Sjoerg 497330f729Sjoerg.. option:: --binary-architecture <arch>, -B 507330f729Sjoerg 517330f729Sjoerg Ignored for compatibility. 527330f729Sjoerg 537330f729Sjoerg.. option:: --disable-deterministic-archives, -U 547330f729Sjoerg 557330f729Sjoerg Use real values for UIDs, GIDs and timestamps when updating archive member 567330f729Sjoerg headers. 577330f729Sjoerg 587330f729Sjoerg.. option:: --discard-all, -x 597330f729Sjoerg 607330f729Sjoerg Remove most local symbols from the output. Different file formats may limit 617330f729Sjoerg this to a subset of the local symbols. For example, file and section symbols in 62*82d56013Sjoerg ELF objects will not be discarded. Additionally, remove all debug sections. 63*82d56013Sjoerg 64*82d56013Sjoerg.. option:: --dump-section <section>=<file> 65*82d56013Sjoerg 66*82d56013Sjoerg Dump the contents of section ``<section>`` into the file ``<file>``. Can be 67*82d56013Sjoerg specified multiple times to dump multiple sections to different files. 68*82d56013Sjoerg ``<file>`` is unrelated to the input and output files provided to 69*82d56013Sjoerg :program:`llvm-objcopy` and as such the normal copying and editing 70*82d56013Sjoerg operations will still be performed. No operations are performed on the sections 71*82d56013Sjoerg prior to dumping them. 72*82d56013Sjoerg 73*82d56013Sjoerg For MachO objects, ``<section>`` must be formatted as 74*82d56013Sjoerg ``<segment name>,<section name>``. 757330f729Sjoerg 767330f729Sjoerg.. option:: --enable-deterministic-archives, -D 777330f729Sjoerg 787330f729Sjoerg Enable deterministic mode when copying archives, i.e. use 0 for archive member 797330f729Sjoerg header UIDs, GIDs and timestamp fields. On by default. 807330f729Sjoerg 817330f729Sjoerg.. option:: --help, -h 827330f729Sjoerg 837330f729Sjoerg Print a summary of command line options. 847330f729Sjoerg 85*82d56013Sjoerg.. option:: --only-keep-debug 86*82d56013Sjoerg 87*82d56013Sjoerg Produce a debug file as the output that only preserves contents of sections 88*82d56013Sjoerg useful for debugging purposes. 89*82d56013Sjoerg 90*82d56013Sjoerg For ELF objects, this removes the contents of `SHF_ALLOC` sections that are not 91*82d56013Sjoerg `SHT_NOTE` by making them `SHT_NOBITS` and shrinking the program headers where 92*82d56013Sjoerg possible. 93*82d56013Sjoerg 947330f729Sjoerg.. option:: --only-section <section>, -j 957330f729Sjoerg 967330f729Sjoerg Remove all sections from the output, except for sections named ``<section>``. 977330f729Sjoerg Can be specified multiple times to keep multiple sections. 987330f729Sjoerg 997330f729Sjoerg For MachO objects, ``<section>`` must be formatted as 1007330f729Sjoerg ``<segment name>,<section name>``. 1017330f729Sjoerg 102*82d56013Sjoerg.. option:: --redefine-sym <old>=<new> 103*82d56013Sjoerg 104*82d56013Sjoerg Rename symbols called ``<old>`` to ``<new>`` in the output. Can be specified 105*82d56013Sjoerg multiple times to rename multiple symbols. 106*82d56013Sjoerg 107*82d56013Sjoerg.. option:: --redefine-syms <filename> 108*82d56013Sjoerg 109*82d56013Sjoerg Rename symbols in the output as described in the file ``<filename>``. In the 110*82d56013Sjoerg file, each line represents a single symbol to rename, with the old name and new 111*82d56013Sjoerg name separated by whitespace. Leading and trailing whitespace is ignored, as is 112*82d56013Sjoerg anything following a '#'. Can be specified multiple times to read names from 113*82d56013Sjoerg multiple files. 114*82d56013Sjoerg 1157330f729Sjoerg.. option:: --regex 1167330f729Sjoerg 1177330f729Sjoerg If specified, symbol and section names specified by other switches are treated 1187330f729Sjoerg as extended POSIX regular expression patterns. 1197330f729Sjoerg 1207330f729Sjoerg.. option:: --remove-section <section>, -R 1217330f729Sjoerg 1227330f729Sjoerg Remove the specified section from the output. Can be specified multiple times 1237330f729Sjoerg to remove multiple sections simultaneously. 1247330f729Sjoerg 125*82d56013Sjoerg For MachO objects, ``<section>`` must be formatted as 126*82d56013Sjoerg ``<segment name>,<section name>``. 127*82d56013Sjoerg 1287330f729Sjoerg.. option:: --set-section-alignment <section>=<align> 1297330f729Sjoerg 1307330f729Sjoerg Set the alignment of section ``<section>`` to `<align>``. Can be specified 1317330f729Sjoerg multiple times to update multiple sections. 1327330f729Sjoerg 133*82d56013Sjoerg.. option:: --set-section-flags <section>=<flag>[,<flag>,...] 134*82d56013Sjoerg 135*82d56013Sjoerg Set section properties in the output of section ``<section>`` based on the 136*82d56013Sjoerg specified ``<flag>`` values. Can be specified multiple times to update multiple 137*82d56013Sjoerg sections. 138*82d56013Sjoerg 139*82d56013Sjoerg Supported flag names are `alloc`, `load`, `noload`, `readonly`, `exclude`, 140*82d56013Sjoerg `debug`, `code`, `data`, `rom`, `share`, `contents`, `merge` and `strings`. Not 141*82d56013Sjoerg all flags are meaningful for all object file formats. 142*82d56013Sjoerg 143*82d56013Sjoerg For ELF objects, the flags have the following effects: 144*82d56013Sjoerg 145*82d56013Sjoerg - `alloc` = add the `SHF_ALLOC` flag. 146*82d56013Sjoerg - `load` = if the section has `SHT_NOBITS` type, mark it as a `SHT_PROGBITS` 147*82d56013Sjoerg section. 148*82d56013Sjoerg - `readonly` = if this flag is not specified, add the `SHF_WRITE` flag. 149*82d56013Sjoerg - `exclude` = add the `SHF_EXCLUDE` flag. 150*82d56013Sjoerg - `code` = add the `SHF_EXECINSTR` flag. 151*82d56013Sjoerg - `merge` = add the `SHF_MERGE` flag. 152*82d56013Sjoerg - `strings` = add the `SHF_STRINGS` flag. 153*82d56013Sjoerg - `contents` = if the section has `SHT_NOBITS` type, mark it as a `SHT_PROGBITS` 154*82d56013Sjoerg section. 155*82d56013Sjoerg 156*82d56013Sjoerg For COFF objects, the flags have the following effects: 157*82d56013Sjoerg 158*82d56013Sjoerg - `alloc` = add the `IMAGE_SCN_CNT_UNINITIALIZED_DATA` and `IMAGE_SCN_MEM_READ` 159*82d56013Sjoerg flags, unless the `load` flag is specified. 160*82d56013Sjoerg - `noload` = add the `IMAGE_SCN_LNK_REMOVE` and `IMAGE_SCN_MEM_READ` flags. 161*82d56013Sjoerg - `readonly` = if this flag is not specified, add the `IMAGE_SCN_MEM_WRITE` 162*82d56013Sjoerg flag. 163*82d56013Sjoerg - `exclude` = add the `IMAGE_SCN_LNK_REMOVE` and `IMAGE_SCN_MEM_READ` flags. 164*82d56013Sjoerg - `debug` = add the `IMAGE_SCN_CNT_INITIALIZED_DATA`, 165*82d56013Sjoerg `IMAGE_SCN_MEM_DISCARDABLE` and `IMAGE_SCN_MEM_READ` flags. 166*82d56013Sjoerg - `code` = add the `IMAGE_SCN_CNT_CODE`, `IMAGE_SCN_MEM_EXECUTE` and 167*82d56013Sjoerg `IMAGE_SCN_MEM_READ` flags. 168*82d56013Sjoerg - `data` = add the `IMAGE_SCN_CNT_INITIALIZED_DATA` and `IMAGE_SCN_MEM_READ` 169*82d56013Sjoerg flags. 170*82d56013Sjoerg - `share` = add the `IMAGE_SCN_MEM_SHARED` and `IMAGE_SCN_MEM_READ` flags. 171*82d56013Sjoerg 1727330f729Sjoerg.. option:: --strip-all-gnu 1737330f729Sjoerg 1747330f729Sjoerg Remove all symbols, debug sections and relocations from the output. This option 1757330f729Sjoerg is equivalent to GNU :program:`objcopy`'s ``--strip-all`` switch. 1767330f729Sjoerg 1777330f729Sjoerg.. option:: --strip-all, -S 1787330f729Sjoerg 1797330f729Sjoerg For ELF objects, remove from the output all symbols and non-alloc sections not 180*82d56013Sjoerg within segments, except for .gnu.warning, .ARM.attribute sections and the 181*82d56013Sjoerg section name table. 1827330f729Sjoerg 183*82d56013Sjoerg For COFF and Mach-O objects, remove all symbols, debug sections, and 184*82d56013Sjoerg relocations from the output. 1857330f729Sjoerg 1867330f729Sjoerg.. option:: --strip-debug, -g 1877330f729Sjoerg 1887330f729Sjoerg Remove all debug sections from the output. 1897330f729Sjoerg 1907330f729Sjoerg.. option:: --strip-symbol <symbol>, -N 1917330f729Sjoerg 1927330f729Sjoerg Remove all symbols named ``<symbol>`` from the output. Can be specified 1937330f729Sjoerg multiple times to remove multiple symbols. 1947330f729Sjoerg 1957330f729Sjoerg.. option:: --strip-symbols <filename> 1967330f729Sjoerg 1977330f729Sjoerg Remove all symbols whose names appear in the file ``<filename>``, from the 1987330f729Sjoerg output. In the file, each line represents a single symbol name, with leading 1997330f729Sjoerg and trailing whitespace ignored, as is anything following a '#'. Can be 2007330f729Sjoerg specified multiple times to read names from multiple files. 2017330f729Sjoerg 2027330f729Sjoerg.. option:: --strip-unneeded-symbol <symbol> 2037330f729Sjoerg 2047330f729Sjoerg Remove from the output all symbols named ``<symbol>`` that are local or 2057330f729Sjoerg undefined and are not required by any relocation. 2067330f729Sjoerg 2077330f729Sjoerg.. option:: --strip-unneeded-symbols <filename> 2087330f729Sjoerg 2097330f729Sjoerg Remove all symbols whose names appear in the file ``<filename>``, from the 2107330f729Sjoerg output, if they are local or undefined and are not required by any relocation. 2117330f729Sjoerg In the file, each line represents a single symbol name, with leading and 2127330f729Sjoerg trailing whitespace ignored, as is anything following a '#'. Can be specified 2137330f729Sjoerg multiple times to read names from multiple files. 2147330f729Sjoerg 2157330f729Sjoerg.. option:: --strip-unneeded 2167330f729Sjoerg 2177330f729Sjoerg Remove from the output all local or undefined symbols that are not required by 2187330f729Sjoerg relocations. Also remove all debug sections. 2197330f729Sjoerg 2207330f729Sjoerg.. option:: --version, -V 2217330f729Sjoerg 2227330f729Sjoerg Display the version of the :program:`llvm-objcopy` executable. 2237330f729Sjoerg 2247330f729Sjoerg.. option:: --wildcard, -w 2257330f729Sjoerg 2267330f729Sjoerg Allow wildcard syntax for symbol-related flags. On by default for 2277330f729Sjoerg section-related flags. Incompatible with --regex. 2287330f729Sjoerg 2297330f729Sjoerg Wildcard syntax allows the following special symbols: 2307330f729Sjoerg 2317330f729Sjoerg ====================== ========================= ================== 2327330f729Sjoerg Character Meaning Equivalent 2337330f729Sjoerg ====================== ========================= ================== 2347330f729Sjoerg ``*`` Any number of characters ``.*`` 2357330f729Sjoerg ``?`` Any single character ``.`` 2367330f729Sjoerg ``\`` Escape the next character ``\`` 2377330f729Sjoerg ``[a-z]`` Character class ``[a-z]`` 2387330f729Sjoerg ``[!a-z]``, ``[^a-z]`` Negated character class ``[^a-z]`` 2397330f729Sjoerg ====================== ========================= ================== 2407330f729Sjoerg 2417330f729Sjoerg Additionally, starting a wildcard with '!' will prevent a match, even if 2427330f729Sjoerg another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols 2437330f729Sjoerg except for ``x``. 2447330f729Sjoerg 2457330f729Sjoerg The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is 2467330f729Sjoerg the same as ``-w -N '!x' -N '*'``. 2477330f729Sjoerg 248*82d56013Sjoerg.. option:: @<FILE> 2497330f729Sjoerg 250*82d56013Sjoerg Read command-line options and commands from response file `<FILE>`. 2517330f729Sjoerg 2527330f729SjoergELF-SPECIFIC OPTIONS 2537330f729Sjoerg-------------------- 2547330f729Sjoerg 2557330f729SjoergThe following options are implemented only for ELF objects. If used with other 2567330f729Sjoergobjects, :program:`llvm-objcopy` will either emit an error or silently ignore 2577330f729Sjoergthem. 2587330f729Sjoerg 2597330f729Sjoerg.. option:: --add-symbol <name>=[<section>:]<value>[,<flags>] 2607330f729Sjoerg 2617330f729Sjoerg Add a new symbol called ``<name>`` to the output symbol table, in the section 2627330f729Sjoerg named ``<section>``, with value ``<value>``. If ``<section>`` is not specified, 2637330f729Sjoerg the symbol is added as an absolute symbol. The ``<flags>`` affect the symbol 2647330f729Sjoerg properties. Accepted values are: 2657330f729Sjoerg 2667330f729Sjoerg - `global` = the symbol will have global binding. 2677330f729Sjoerg - `local` = the symbol will have local binding. 2687330f729Sjoerg - `weak` = the symbol will have weak binding. 2697330f729Sjoerg - `default` = the symbol will have default visibility. 2707330f729Sjoerg - `hidden` = the symbol will have hidden visibility. 2717330f729Sjoerg - `protected` = the symbol will have protected visibility. 2727330f729Sjoerg - `file` = the symbol will be an `STT_FILE` symbol. 2737330f729Sjoerg - `section` = the symbol will be an `STT_SECTION` symbol. 2747330f729Sjoerg - `object` = the symbol will be an `STT_OBJECT` symbol. 2757330f729Sjoerg - `function` = the symbol will be an `STT_FUNC` symbol. 2767330f729Sjoerg - `indirect-function` = the symbol will be an `STT_GNU_IFUNC` symbol. 2777330f729Sjoerg 2787330f729Sjoerg Additionally, the following flags are accepted but ignored: `debug`, 2797330f729Sjoerg `constructor`, `warning`, `indirect`, `synthetic`, `unique-object`, `before`. 2807330f729Sjoerg 2817330f729Sjoerg Can be specified multiple times to add multiple symbols. 2827330f729Sjoerg 2837330f729Sjoerg.. option:: --allow-broken-links 2847330f729Sjoerg 2857330f729Sjoerg Allow :program:`llvm-objcopy` to remove sections even if it would leave invalid 2867330f729Sjoerg section references. Any invalid sh_link fields will be set to zero. 2877330f729Sjoerg 2887330f729Sjoerg.. option:: --change-start <incr>, --adjust-start 2897330f729Sjoerg 2907330f729Sjoerg Add ``<incr>`` to the program's start address. Can be specified multiple 2917330f729Sjoerg times, in which case the values will be applied cumulatively. 2927330f729Sjoerg 2937330f729Sjoerg.. option:: --compress-debug-sections [<style>] 2947330f729Sjoerg 2957330f729Sjoerg Compress DWARF debug sections in the output, using the specified style. 2967330f729Sjoerg Supported styles are `zlib-gnu` and `zlib`. Defaults to `zlib` if no style is 2977330f729Sjoerg specified. 2987330f729Sjoerg 2997330f729Sjoerg.. option:: --decompress-debug-sections 3007330f729Sjoerg 3017330f729Sjoerg Decompress any compressed DWARF debug sections in the output. 3027330f729Sjoerg 3037330f729Sjoerg.. option:: --discard-locals, -X 3047330f729Sjoerg 3057330f729Sjoerg Remove local symbols starting with ".L" from the output. 3067330f729Sjoerg 3077330f729Sjoerg.. option:: --extract-dwo 3087330f729Sjoerg 3097330f729Sjoerg Remove all sections that are not DWARF .dwo sections from the output. 3107330f729Sjoerg 3117330f729Sjoerg.. option:: --extract-main-partition 3127330f729Sjoerg 3137330f729Sjoerg Extract the main partition from the output. 3147330f729Sjoerg 3157330f729Sjoerg.. option:: --extract-partition <name> 3167330f729Sjoerg 3177330f729Sjoerg Extract the named partition from the output. 3187330f729Sjoerg 3197330f729Sjoerg.. option:: --globalize-symbol <symbol> 3207330f729Sjoerg 3217330f729Sjoerg Mark any defined symbols named ``<symbol>`` as global symbols in the output. 3227330f729Sjoerg Can be specified multiple times to mark multiple symbols. 3237330f729Sjoerg 3247330f729Sjoerg.. option:: --globalize-symbols <filename> 3257330f729Sjoerg 3267330f729Sjoerg Read a list of names from the file ``<filename>`` and mark defined symbols with 3277330f729Sjoerg those names as global in the output. In the file, each line represents a single 3287330f729Sjoerg symbol, with leading and trailing whitespace ignored, as is anything following 3297330f729Sjoerg a '#'. Can be specified multiple times to read names from multiple files. 3307330f729Sjoerg 3317330f729Sjoerg.. option:: --input-target <format>, -I 3327330f729Sjoerg 3337330f729Sjoerg Read the input as the specified format. See `SUPPORTED FORMATS`_ for a list of 3347330f729Sjoerg valid ``<format>`` values. If unspecified, :program:`llvm-objcopy` will attempt 3357330f729Sjoerg to determine the format automatically. 3367330f729Sjoerg 3377330f729Sjoerg.. option:: --keep-file-symbols 3387330f729Sjoerg 3397330f729Sjoerg Keep symbols of type `STT_FILE`, even if they would otherwise be stripped. 3407330f729Sjoerg 3417330f729Sjoerg.. option:: --keep-global-symbol <symbol> 3427330f729Sjoerg 3437330f729Sjoerg Make all symbols local in the output, except for symbols with the name 3447330f729Sjoerg ``<symbol>``. Can be specified multiple times to ignore multiple symbols. 3457330f729Sjoerg 3467330f729Sjoerg.. option:: --keep-global-symbols <filename> 3477330f729Sjoerg 3487330f729Sjoerg Make all symbols local in the output, except for symbols named in the file 3497330f729Sjoerg ``<filename>``. In the file, each line represents a single symbol, with leading 3507330f729Sjoerg and trailing whitespace ignored, as is anything following a '#'. Can be 3517330f729Sjoerg specified multiple times to read names from multiple files. 3527330f729Sjoerg 3537330f729Sjoerg.. option:: --keep-section <section> 3547330f729Sjoerg 3557330f729Sjoerg When removing sections from the output, do not remove sections named 3567330f729Sjoerg ``<section>``. Can be specified multiple times to keep multiple sections. 3577330f729Sjoerg 3587330f729Sjoerg.. option:: --keep-symbol <symbol>, -K 3597330f729Sjoerg 3607330f729Sjoerg When removing symbols from the output, do not remove symbols named 3617330f729Sjoerg ``<symbol>``. Can be specified multiple times to keep multiple symbols. 3627330f729Sjoerg 3637330f729Sjoerg.. option:: --keep-symbols <filename> 3647330f729Sjoerg 3657330f729Sjoerg When removing symbols from the output do not remove symbols named in the file 3667330f729Sjoerg ``<filename>``. In the file, each line represents a single symbol, with leading 3677330f729Sjoerg and trailing whitespace ignored, as is anything following a '#'. Can be 3687330f729Sjoerg specified multiple times to read names from multiple files. 3697330f729Sjoerg 3707330f729Sjoerg.. option:: --localize-hidden 3717330f729Sjoerg 3727330f729Sjoerg Make all symbols with hidden or internal visibility local in the output. 3737330f729Sjoerg 3747330f729Sjoerg.. option:: --localize-symbol <symbol>, -L 3757330f729Sjoerg 3767330f729Sjoerg Mark any defined non-common symbol named ``<symbol>`` as a local symbol in the 3777330f729Sjoerg output. Can be specified multiple times to mark multiple symbols as local. 3787330f729Sjoerg 3797330f729Sjoerg.. option:: --localize-symbols <filename> 3807330f729Sjoerg 3817330f729Sjoerg Read a list of names from the file ``<filename>`` and mark defined non-common 3827330f729Sjoerg symbols with those names as local in the output. In the file, each line 3837330f729Sjoerg represents a single symbol, with leading and trailing whitespace ignored, as is 3847330f729Sjoerg anything following a '#'. Can be specified multiple times to read names from 3857330f729Sjoerg multiple files. 3867330f729Sjoerg 3877330f729Sjoerg.. option:: --new-symbol-visibility <visibility> 3887330f729Sjoerg 3897330f729Sjoerg Specify the visibility of the symbols automatically created when using binary 3907330f729Sjoerg input or :option:`--add-symbol`. Valid options are: 3917330f729Sjoerg 3927330f729Sjoerg - `default` 3937330f729Sjoerg - `hidden` 3947330f729Sjoerg - `internal` 3957330f729Sjoerg - `protected` 3967330f729Sjoerg 3977330f729Sjoerg The default is `default`. 3987330f729Sjoerg 3997330f729Sjoerg.. option:: --output-target <format>, -O 4007330f729Sjoerg 4017330f729Sjoerg Write the output as the specified format. See `SUPPORTED FORMATS`_ for a list 4027330f729Sjoerg of valid ``<format>`` values. If unspecified, the output format is assumed to 403*82d56013Sjoerg be the same as the value specified for :option:`--input-target` or the input 404*82d56013Sjoerg file's format if that option is also unspecified. 4057330f729Sjoerg 4067330f729Sjoerg.. option:: --prefix-alloc-sections <prefix> 4077330f729Sjoerg 4087330f729Sjoerg Add ``<prefix>`` to the front of the names of all allocatable sections in the 4097330f729Sjoerg output. 4107330f729Sjoerg 4117330f729Sjoerg.. option:: --prefix-symbols <prefix> 4127330f729Sjoerg 4137330f729Sjoerg Add ``<prefix>`` to the front of every symbol name in the output. 4147330f729Sjoerg 4157330f729Sjoerg.. option:: --preserve-dates, -p 4167330f729Sjoerg 4177330f729Sjoerg Preserve access and modification timestamps in the output. 4187330f729Sjoerg 4197330f729Sjoerg.. option:: --rename-section <old>=<new>[,<flag>,...] 4207330f729Sjoerg 4217330f729Sjoerg Rename sections called ``<old>`` to ``<new>`` in the output, and apply any 4227330f729Sjoerg specified ``<flag>`` values. See :option:`--set-section-flags` for a list of 4237330f729Sjoerg supported flags. Can be specified multiple times to rename multiple sections. 4247330f729Sjoerg 4257330f729Sjoerg.. option:: --set-start-addr <addr> 4267330f729Sjoerg 4277330f729Sjoerg Set the start address of the output to ``<addr>``. Overrides any previously 4287330f729Sjoerg specified :option:`--change-start` or :option:`--adjust-start` options. 4297330f729Sjoerg 4307330f729Sjoerg.. option:: --split-dwo <dwo-file> 4317330f729Sjoerg 4327330f729Sjoerg Equivalent to running :program:`llvm-objcopy` with :option:`--extract-dwo` and 4337330f729Sjoerg ``<dwo-file>`` as the output file and no other options, and then with 4347330f729Sjoerg :option:`--strip-dwo` on the input file. 4357330f729Sjoerg 4367330f729Sjoerg.. option:: --strip-dwo 4377330f729Sjoerg 4387330f729Sjoerg Remove all DWARF .dwo sections from the output. 4397330f729Sjoerg 4407330f729Sjoerg.. option:: --strip-non-alloc 4417330f729Sjoerg 4427330f729Sjoerg Remove from the output all non-allocatable sections that are not within 4437330f729Sjoerg segments. 4447330f729Sjoerg 4457330f729Sjoerg.. option:: --strip-sections 4467330f729Sjoerg 4477330f729Sjoerg Remove from the output all section headers and all section data not within 4487330f729Sjoerg segments. Note that many tools will not be able to use an object without 4497330f729Sjoerg section headers. 4507330f729Sjoerg 4517330f729Sjoerg.. option:: --target <format>, -F 4527330f729Sjoerg 4537330f729Sjoerg Equivalent to :option:`--input-target` and :option:`--output-target` for the 4547330f729Sjoerg specified format. See `SUPPORTED FORMATS`_ for a list of valid ``<format>`` 4557330f729Sjoerg values. 4567330f729Sjoerg 4577330f729Sjoerg.. option:: --weaken-symbol <symbol>, -W 4587330f729Sjoerg 4597330f729Sjoerg Mark any global symbol named ``<symbol>`` as a weak symbol in the output. Can 4607330f729Sjoerg be specified multiple times to mark multiple symbols as weak. 4617330f729Sjoerg 4627330f729Sjoerg.. option:: --weaken-symbols <filename> 4637330f729Sjoerg 4647330f729Sjoerg Read a list of names from the file ``<filename>`` and mark global symbols with 4657330f729Sjoerg those names as weak in the output. In the file, each line represents a single 4667330f729Sjoerg symbol, with leading and trailing whitespace ignored, as is anything following 4677330f729Sjoerg a '#'. Can be specified multiple times to read names from multiple files. 4687330f729Sjoerg 4697330f729Sjoerg.. option:: --weaken 4707330f729Sjoerg 4717330f729Sjoerg Mark all defined global symbols as weak in the output. 4727330f729Sjoerg 473*82d56013SjoergMACH-O-SPECIFIC OPTIONS 474*82d56013Sjoerg----------------------- 475*82d56013Sjoerg 476*82d56013Sjoerg.. option:: --keep-undefined 477*82d56013Sjoerg 478*82d56013Sjoerg Keep undefined symbols, even if they would otherwise be stripped. 479*82d56013Sjoerg 4807330f729SjoergSUPPORTED FORMATS 4817330f729Sjoerg----------------- 4827330f729Sjoerg 4837330f729SjoergThe following values are currently supported by :program:`llvm-objcopy` for the 4847330f729Sjoerg:option:`--input-target`, :option:`--output-target`, and :option:`--target` 4857330f729Sjoergoptions. For GNU :program:`objcopy` compatibility, the values are all bfdnames. 4867330f729Sjoerg 4877330f729Sjoerg- `binary` 4887330f729Sjoerg- `ihex` 4897330f729Sjoerg- `elf32-i386` 4907330f729Sjoerg- `elf32-x86-64` 4917330f729Sjoerg- `elf64-x86-64` 4927330f729Sjoerg- `elf32-iamcu` 4937330f729Sjoerg- `elf32-littlearm` 4947330f729Sjoerg- `elf64-aarch64` 4957330f729Sjoerg- `elf64-littleaarch64` 4967330f729Sjoerg- `elf32-littleriscv` 4977330f729Sjoerg- `elf64-littleriscv` 4987330f729Sjoerg- `elf32-powerpc` 4997330f729Sjoerg- `elf32-powerpcle` 5007330f729Sjoerg- `elf64-powerpc` 5017330f729Sjoerg- `elf64-powerpcle` 5027330f729Sjoerg- `elf32-bigmips` 5037330f729Sjoerg- `elf32-ntradbigmips` 5047330f729Sjoerg- `elf32-ntradlittlemips` 5057330f729Sjoerg- `elf32-tradbigmips` 5067330f729Sjoerg- `elf32-tradlittlemips` 5077330f729Sjoerg- `elf64-tradbigmips` 5087330f729Sjoerg- `elf64-tradlittlemips` 5097330f729Sjoerg- `elf32-sparc` 5107330f729Sjoerg- `elf32-sparcel` 5117330f729Sjoerg 5127330f729SjoergAdditionally, all targets except `binary` and `ihex` can have `-freebsd` as a 5137330f729Sjoergsuffix. 5147330f729Sjoerg 5157330f729SjoergBINARY INPUT AND OUTPUT 5167330f729Sjoerg----------------------- 5177330f729Sjoerg 5187330f729SjoergIf `binary` is used as the value for :option:`--input-target`, the input file 5197330f729Sjoergwill be embedded as a data section in an ELF relocatable object, with symbols 5207330f729Sjoerg``_binary_<file_name>_start``, ``_binary_<file_name>_end``, and 5217330f729Sjoerg``_binary_<file_name>_size`` representing the start, end and size of the data, 5227330f729Sjoergwhere ``<file_name>`` is the path of the input file as specified on the command 5237330f729Sjoergline with non-alphanumeric characters converted to ``_``. 5247330f729Sjoerg 5257330f729SjoergIf `binary` is used as the value for :option:`--output-target`, the output file 5267330f729Sjoergwill be a raw binary file, containing the memory image of the input file. 5277330f729SjoergSymbols and relocation information will be discarded. The image will start at 5287330f729Sjoergthe address of the first loadable section in the output. 5297330f729Sjoerg 5307330f729SjoergEXIT STATUS 5317330f729Sjoerg----------- 5327330f729Sjoerg 5337330f729Sjoerg:program:`llvm-objcopy` exits with a non-zero exit code if there is an error. 5347330f729SjoergOtherwise, it exits with code 0. 5357330f729Sjoerg 5367330f729SjoergBUGS 5377330f729Sjoerg---- 5387330f729Sjoerg 539*82d56013SjoergTo report bugs, please visit <https://bugs.llvm.org/>. 5407330f729Sjoerg 5417330f729SjoergThere is a known issue with :option:`--input-target` and :option:`--target` 5427330f729Sjoergcausing only ``binary`` and ``ihex`` formats to have any effect. Other values 5437330f729Sjoergwill be ignored and :program:`llvm-objcopy` will attempt to guess the input 5447330f729Sjoergformat. 5457330f729Sjoerg 5467330f729SjoergSEE ALSO 5477330f729Sjoerg-------- 5487330f729Sjoerg 5497330f729Sjoerg:manpage:`llvm-strip(1)` 550