OVERVIEW: llvm-objcopy tool
USAGE: llvm-objcopy [options] input [output]
OPTIONS:
--add-gnu-debuglink=debug-file
Add a .gnu_debuglink for <debug-file>
--add-section=section=file
Add a section named <section> with the contents of <file>
--add-symbol=name=[section:]value[,flags]
Add new symbol <name> to .symtab. Accepted flags: global, local, weak, default, hidden, protected, file, section, object, function, indirect-function. Accepted but ignored for compatibility: debug, constructor, warning, indirect, synthetic, unique-object, before
--adjust-section-vma <value>
Alias for --change-section-address
--adjust-start <value> Alias for --change-start
--allow-broken-links Allow the tool to remove sections even if it would leave invalid section references. The appropriate sh_link fields will be set to zero.
--binary-architecture=<value>
Ignored for compatibility
-B <value> Alias for --binary-architecture
--change-section-address=sectionpattern{=|+|-}val
Set the address of the <section> to, or adjust it by, <val>
--change-section-lma=*{+|-}val
Shift LMA of non-zero-sized sections in the program header by <val>
--change-start=incr Add <incr> to the start address. Can be specified multiple times, all values will be applied cumulatively
--compress-debug-sections=format
Compress DWARF debug sections using specified format. Supported formats: zlib, zstd. Select zlib if <format> is omitted
--compress-sections=<section-glob>=<format>
Compress or decompress sections using specified format. Supported formats: zlib, zstd. Specify 'none' for decompression
--decompress-debug-sections
Decompress DWARF debug sections
--disable-deterministic-archives
Disable deterministic mode when operating on archives (use real values for UIDs, GIDs, and timestamps).
--discard-all Remove most local symbols. Different file formats may limit this to a subset. For ELF, file and section symbols are not discarded. Additionally, remove all debug sections
--discard-locals Remove local symbols starting with .L
--dump-section=section=file
Dump contents of section named <section> into file <file>
-D Alias for --enable-deterministic-archives
--enable-deterministic-archives
Enable deterministic mode when operating on archives (use zero for UIDs, GIDs, and timestamps).
--extract-dwo Remove all sections that are not DWARF .dwo sections from file
--extract-main-partition
Extract main partition from the input file
--extract-partition=name
Extract named partition from input file
--extract-section=section=file
Extract section named <section> into standalone object in file <file>
-F <value> Alias for --target
--gap-fill=value Fill the gaps between sections with <value> instead of zero. <value> must be an unsigned 8-bit integer. This option is only supported for ELF input and binary output
--globalize-symbol=symbol
Mark <symbol> as global
--globalize-symbols=filename
Read a list of symbols from <filename> and mark defined symbols with those names as global
-G <value> Alias for --keep-global-symbol
-g Alias for --strip-debug
--input-target=format Read the input as the specified format
-I <value> Alias for --input-target
-j <value> Alias for --only-section
--keep-file-symbols Keep symbols of type STT_FILE, even if they would otherwise be stripped
--keep-global-symbol=symbol
Mark all symbols local, except for symbols with the name <symbol>. Can be specified multiple times to ignore multiple symbols
--keep-global-symbols=filename
Read a list of symbols from <filename> and run as if --keep-global-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files
--keep-section=section Keep <section>
--keep-symbol=symbol When removing symbols, do not remove <symbol>
--keep-symbols=filename Read a list of symbols from <filename> and run as if --keep-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files
-K <value> Alias for --keep-symbol
--localize-hidden Mark all symbols that have hidden or internal visibility as local
--localize-symbol=symbol
Mark any defined non-common symbol named <symbol> as local
--localize-symbols=filename
Read a list of names from <filename> and mark any defined non-common symbols with those names as local
-L <value> Alias for --localize-symbol
--new-symbol-visibility=<value>
Specify the visibility of symbols automatically created when using binary input or --add-symbol. The default is 'default'
--no-verify-note-sections
Don't validate note sections
-N <value> Alias for --strip-symbol
--only-keep-debug Produce a debug file as the output that only preserves contents of sections useful for debugging purposes
--only-section=section Remove all but <section>
--output-target=format Write the output as the specified format
-O <value> Alias for --output-target
--pad-to=address Pad the output up to the load address <address>, using a value of zero or the value specified by the --gap-fill option. This option is only supported for ELF input and binary output
--prefix-alloc-sections=prefix
Add <prefix> to the start of every allocated section name
--prefix-symbols=prefix Add <prefix> to the start of every symbol name
--preserve-dates Preserve access and modification timestamps
-p Alias for --preserve-dates
--redefine-sym=old=new Change the name of a symbol old to new
--redefine-syms=filename
Read a list of symbol pairs from <filename> and run as if --redefine-sym=<old>=<new> is set for each one. <filename> contains two symbols per line separated with whitespace and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files
--regex Permit regular expressions in name comparison
--remove-note=[name/]type_id
Remove note(s) with <type_id> and optional <name>
--remove-section=section
Remove <section>
--remove-symbol-prefix=prefix
Remove <prefix> from the start of every symbol name. No-op for symbols that do not start with <prefix>
--rename-section=old=new[,flag1,...]
Rename sections called <old> to <new>, and apply any specified <flag> values. See --set-section-flags for a list of supported flags
-R <value> Alias for --remove-section
--set-section-alignment=section=align
Set alignment for a given section
--set-section-flags=section=flag1[,flag2,...]
Set section properties based on the specified <flags>. Supported flag names are: alloc, load, noload, readonly, exclude, debug, code, data, rom, share, contents, merge, strings, large
--set-section-type=section=type
Set the type of section <section> to the integer <type>
--set-start=addr Set the start address to <addr>. Overrides any previous --change-start or --adjust-start values
--set-symbol-visibility=symbol=visibility
Change the visibility of a symbol to the specified value
--set-symbols-visibility=filename=visibility
Read a list of symbols from <filename> and change their visibility to the specified value. Visibility values: default, internal, hidden, protected
--skip-symbol=symbol Do not change parameters of symbol <symbol> when executing other options that can change the symbol's name, binding or visibility
--skip-symbols=filename Read a list of symbols from <filename> and run as if --skip-symbol=<symbol> is set for each one. <filename> contains one symbol per line and may contain comments beginning with '#'. Leading and trailing whitespace is stripped from each line. May be repeated to read symbols from many files
--split-dwo=dwo-file Equivalent to --extract-dwo and <dwo-file> as the output file and no other options, and then --strip-dwo on the input file
--strip-all-gnu Remove all symbols, debug sections and relocations. Compatible with GNU's --strip-all
--strip-all For ELF, remove all symbols and non-alloc sections not within segments, except for .gnu.warning*, .ARM.attribute, and the section name table. For COFF and Mach-O, remove all symbols, debug sections, and relocations
--strip-debug Remove all debug sections
--strip-dwo Remove all DWARF .dwo sections
--strip-non-alloc Remove all non-allocated sections that are not within segments
--strip-sections Remove all section headers and all section data not within segments
--strip-symbol=symbol Strip <symbol>
--strip-symbols=filename
Remove all symbols whose names appear in the file <filename>
--strip-unneeded-symbol=symbol
Remove all symbols named <symbol> that are local or undefined and are not required by any relocation
--strip-unneeded-symbols=filename
Remove all symbols whose names appear in the file <file>, if they are local or undefined and are not required by any relocation
--strip-unneeded Remove all symbols not needed by relocations
-S Alias for --strip-all
--target=<value> Equivalent to --input-target and --output-target for the specified format
--update-section=name=file
Replace the contents of section <name> with contents from a file <file>
-U Alias for --disable-deterministic-archives
--verify-note-sections Validate note sections
--version Print the version and exit.
-V Alias for --version
--weaken-symbol=symbol Mark global symbols named <symbol> as weak
--weaken-symbols=filename
Read a list of symbols from <filename> and mark global symbols with those names as weak
--weaken Mark all defined global symbols as weak
--wildcard Allow wildcard syntax for symbol-related flags. Incompatible with --regex. Allows using '*' to match any number of characters, '?' to match any single character, '' to escape special characters, and '[]' to define character classes. Wildcards beginning with '!' will prevent a match, for example "-N '*' -N '!x'" will strip all symbols except for "x".
-W <value> Alias for --weaken-symbol
-w Alias for --wildcard
-X Alias for --discard-locals
-x Alias for --discard-all
OPTIONS (COFF specific):
--subsystem=name[:version]
Set the PE subsystem, and optionally subsystem version
OPTIONS (Mach-O specific):
--keep-undefined Do not remove undefined symbols
Pass @FILE as argument to read options from FILE.
Options (97)
| Option | Description | Source |
|---|---|---|
--add-gnu-debuglink debug-file | Add a .gnu_debuglink for <debug-file> | help |
--add-section section=file | Add a section named <section> with the contents of <file> | help |
--add-symbol name=[section:]value | Add new symbol <name> to .symtab. | help |
--adjust-section-vma value | Alias for --change-section-address | help |
--adjust-start value | Alias for --change-start | help |
--allow-broken-links | Allow the tool to remove sections even if it would leave invalid section references. | help |
--binary-architecture value | Ignored for compatibility | help |
-B value | Alias for --binary-architecture | help |
--change-section-address sectionpattern{=|+|-}val | Set the address of the <section> to, or adjust it by, <val> | help |
--change-section-lma *{+|-}val | Shift LMA of non-zero-sized sections in the program header by <val> | help |
--change-start incr | Add <incr> to the start address. | help |
--compress-debug-sections format | Compress DWARF debug sections using specified format. | help |
--compress-sections section-glob>=<format | Compress or decompress sections using specified format. | help |
--decompress-debug-sections | Decompress DWARF debug sections | help |
--disable-deterministic-archives | Disable deterministic mode when operating on archives (use real values for UIDs, GIDs, and timestamps). | help |
--discard-all | Remove most local symbols. | help |
--discard-locals | Remove local symbols starting with .L | help |
--dump-section section=file | Dump contents of section named <section> into file <file> | help |
-D | Alias for --enable-deterministic-archives | help |
--enable-deterministic-archives | Enable deterministic mode when operating on archives (use zero for UIDs, GIDs, and timestamps). | help |
--extract-dwo | Remove all sections that are not DWARF .dwo sections from file | help |
--extract-main-partition | Extract main partition from the input file | help |
--extract-partition name | Extract named partition from input file | help |
--extract-section section=file | Extract section named <section> into standalone object in file <file> | help |
-F value | Alias for --target | help |
--gap-fill value | Fill the gaps between sections with <value> instead of zero. | help |
--globalize-symbol symbol | Mark <symbol> as global | help |
--globalize-symbols filename | Read a list of symbols from <filename> and mark defined symbols with those names as global | help |
-G value | Alias for --keep-global-symbol | help |
-g | Alias for --strip-debug | help |
--input-target format | Read the input as the specified format | help |
-I value | Alias for --input-target | help |
-j value | Alias for --only-section | help |
--keep-file-symbols | Keep symbols of type STT_FILE, even if they would otherwise be stripped | help |
--keep-global-symbol symbol | Mark all symbols local, except for symbols with the name <symbol>. | help |
--keep-global-symbols filename | Read a list of symbols from <filename> and run as if --keep-global-symbol=<symbol> is set for each one. | help |
--keep-section section | Keep <section> | help |
--keep-symbol symbol | When removing symbols, do not remove <symbol> | help |
-K value | Alias for --keep-symbol | help |
--localize-hidden | Mark all symbols that have hidden or internal visibility as local | help |
--localize-symbol symbol | Mark any defined non-common symbol named <symbol> as local | help |
--localize-symbols filename | Read a list of names from <filename> and mark any defined non-common symbols with those names as local | help |
-L value | Alias for --localize-symbol | help |
--new-symbol-visibility value | Specify the visibility of symbols automatically created when using binary input or --add-symbol. | help |
--no-verify-note-sections | Don't validate note sections | help |
-N value | Alias for --strip-symbol | help |
--only-keep-debug | Produce a debug file as the output that only preserves contents of sections useful for debugging purposes | help |
--only-section section | Remove all but <section> | help |
--output-target format | Write the output as the specified format | help |
-O value | Alias for --output-target | help |
--pad-to address | Pad the output up to the load address <address>, using a value of zero or the value specified by the --gap-fill option. | help |
--prefix-alloc-sections prefix | Add <prefix> to the start of every allocated section name | help |
--preserve-dates | Preserve access and modification timestamps | help |
-p | Alias for --preserve-dates | help |
--redefine-sym old=new | Change the name of a symbol old to new | help |
--redefine-syms filename | Read a list of symbol pairs from <filename> and run as if --redefine-sym=<old>=<new> is set for each one. | help |
--regex | Permit regular expressions in name comparison | help |
--remove-note name/]type_id | Remove note(s) with <type_id> and optional <name> | help |
--remove-section section | Remove <section> | help |
--remove-symbol-prefix prefix | Remove <prefix> from the start of every symbol name. | help |
--rename-section old=new | Rename sections called <old> to <new>, and apply any specified <flag> values. | help |
-R value | Alias for --remove-section | help |
--set-section-alignment section=align | Set alignment for a given section | help |
--set-section-flags section=flag1 | Set section properties based on the specified <flags>. | help |
--set-section-type section=type | Set the type of section <section> to the integer <type> | help |
--set-start addr | Set the start address to <addr>. | help |
--set-symbol-visibility symbol=visibility | Change the visibility of a symbol to the specified value | help |
--set-symbols-visibility filename=visibility | Read a list of symbols from <filename> and change their visibility to the specified value. | help |
--skip-symbol symbol | Do not change parameters of symbol <symbol> when executing other options that can change the symbol's name, binding or visibility | help |
--split-dwo dwo-file | Equivalent to --extract-dwo and <dwo-file> as the output file and no other options, and then --strip-dwo on the input file | help |
--strip-all-gnu | Remove all symbols, debug sections and relocations. | help |
--strip-all | For ELF, remove all symbols and non-alloc sections not within segments, except for .gnu.warning*, .ARM.attribute, and the section name table. | help |
--strip-debug | Remove all debug sections | help |
--strip-dwo | Remove all DWARF .dwo sections | help |
--strip-non-alloc | Remove all non-allocated sections that are not within segments | help |
--strip-sections | Remove all section headers and all section data not within segments | help |
--strip-symbol symbol | Strip <symbol> | help |
--strip-symbols filename | Remove all symbols whose names appear in the file <filename> | help |
--strip-unneeded-symbol symbol | Remove all symbols named <symbol> that are local or undefined and are not required by any relocation | help |
--strip-unneeded-symbols filename | Remove all symbols whose names appear in the file <file>, if they are local or undefined and are not required by any relocation | help |
--strip-unneeded | Remove all symbols not needed by relocations | help |
-S | Alias for --strip-all | help |
--target value | Equivalent to --input-target and --output-target for the specified format | help |
--update-section name=file | Replace the contents of section <name> with contents from a file <file> | help |
-U | Alias for --disable-deterministic-archives | help |
--verify-note-sections | Validate note sections | help |
--version | Print the version and exit. | help |
-V | Alias for --version | help |
--weaken-symbol symbol | Mark global symbols named <symbol> as weak | help |
--weaken-symbols filename | Read a list of symbols from <filename> and mark global symbols with those names as weak | help |
--weaken | Mark all defined global symbols as weak | help |
--wildcard | Allow wildcard syntax for symbol-related flags. | help |
-W value | Alias for --weaken-symbol | help |
-w | Alias for --wildcard | help |
-X | Alias for --discard-locals | help |
-x | Alias for --discard-all | help |
--subsystem name[:version | Set the PE subsystem, and optionally subsystem version | help |