man.bsd.lv manual page server

Manual Page Search Parameters

OBJCOPY(1) General Commands Manual OBJCOPY(1)

objcopycopy and translate object files

objcopy [-I objformat | -s objformat | --input-target=objformat] [-K symbolname | --keep-symbol=symbolname] [-L symbolname | --localize-symbol=symbolname] [-N symbolname | --strip-symbol=symbolname] [-O objformat | --output-target=objformat] [-R sectionname | --remove-section=sectionname] [-S | --strip-all] [-V | --version] [-W symbolname | --weaken-symbol=symbolname] [-X | --discard-locals] [-d | -g | --strip-debug] [-h | --help] [-j sectionname | --only-section=sectionname] [-p | --preserve-dates] [-w | --wildcard] [-x | --discard-all] [--add-gnu-debuglink=filename] [--add-section sectionname=filename] [--adjust-section-vma section{+|-|=}val | --change-section-address section{+|-|=}val] [--adjust-start=increment | --change-start=increment] [--adjust-vma=increment | --change-addresses=increment] [--adjust-warnings | --change-warnings] [--change-section-lma section{+|-|=}val] [--change-section-vma section{+|-|=}val] [--extract-dwo] [--gap-fill=val] [--globalize-symbol=ar symbolname] [--globalize-symbols=filename] [--localize-hidden] [--localize-symbols=filename] [--no-adjust-warnings | --no-change-warnings] [--only-keep-debug] [--pad-to=address] [--prefix-alloc-sections=string] [--prefix-sections=string] [--prefix-symbols=string] [--rename-section oldname=newname[,flags]] [--set-section-flags sectionname=flags] [--set-start=address] [--srec-forceS3] [--srec-len=val] [--strip-dwo] [--strip-symbols=filename] [--strip-unneeded] infile [outfile]

The objcopy utility copies the content of the binary object named by argument infile to that named by argument outfile, transforming it according to the command line options specified. If argument outfile is not specified, objcopy will create a temporary file and will subsequently rename it as infile.

The objcopy utility supports the following options:

objformat | objformat | objformat
Specify that the input file named by the argument infile is in the object format specified by the argument objformat.
symbolname | symbolname
Copy the symbol named by argument symbolname to the output.
symbolname | symbolname
Make the symbol named by argument symbolname local to the output file.
symbol | symbolname
Do not copy the symbol named by argument symbolname to the output.
objformat | objformat
Write the output file using the object format specified in argument objformat. The argument objformat should be one of the target names recognized by elftc_bfd_find_target(3).
sectionname | sectionname
Remove any section with name sectionname from the output file.
|
Do not copy symbol and relocation information to the target file.
|
Print a version identifier and exit.
symbolname | symbolname
Mark the symbol named by argument symbolname as weak in the output.
|
Do not copy compiler generated local symbols to the output.
| |
Do not copy debugging information to the target file.
|
Display a help message and exit.
sectionname | sectionname
Copy only the section named by argument sectionname to the output.
|
Set the access and modification times of the output file to the same as those of the input.
|
Use shell-style patterns to name symbols. The following meta-characters are recognized in patterns:
!
If this is the first character of the pattern, invert the sense of the pattern match.
Matches any string of characters in a symbol name.
?
Matches zero or one character in a symbol name.
[
Mark the start of a character class.
\
Remove the special meaning of the next character in the pattern.
]
Mark the end of a character class.
|
Do not copy non-global symbols to the output.
Create a .gnu_debuglink section in the output file that references the debug data in filename.
sectionname=filename
Add a new section to the output file with name sectionname. The contents of the section are taken from the file named by argument filename. The size of the section will be the number of bytes in file filename.
section{+|-|=}val | section{+|-|=}val
Depending on the operator specified, increase, decrease or set both the virtual memory address and the load memory address of the section named by the argument section. The argument val specifies the desired increment, decrement or new value for the address.
=increment | =increment
Increase the entry point address of the output ELF object by the value specified in the argument increment.
=increment | =increment
Increase the virtual memory address and the load memory address of all sections by the value specified by the argument increment.
|
Issue a warning if the section specified by the options --change-section-address, --change-section-lma or --change-section-vma does not exist in the input object. This is the default.
section{+|-|=}val
Change or set the load memory address of the section named by the argument section. Depending on the operator specified, the value in argument val will be used as an increment, a decrement or as the new value of the load memory address.
section{+|-|=}val
Change or set the virtual memory address of the section named by the argument section. Depending on the operator specified, the value in argument val will be used as an increment, a decrement or as the new value of the virtual memory address.
Copy only .dwo debug sections to the output file.
=val
Fill the gaps between sections with the byte value specified by the argument val.
=symbolname
Make the symbol named by argument symbolname global, so that it is visible outside of the file in which it is defined.
=filename
Make each symbol listed in the file specified by filename global.
Make all hidden symbols local to the output file. This includes symbols with internal visiblity.
=filename
Make each symbol listed in the file specified by filename local to the output file.
|
Do not issue a warning if the section specified by the options --change-section-address, --change-section-lma or --change-section-vma is missing in the input object.
Copy only debugging information to the output file.
=address
Pad the load memory address of the output object to the value specified by the argument address by increasing the size of the section with the highest load memory address.
=string
Prefix the section names of all the allocated sections with string.
=string
Prefix the section names of all the sections with string.
=string
Prefix the symbol names of all the symbols with string.
oldname=newname[,flags]
Rename the section named by argument oldname to newname, optionally changing the sections flags to that specified by argument flags. Allowed values for the argument flags are as for option --set-section-flags below.
sectionname=flags
Set the flags for the section named by argument sectionname to those specified by argument flags. Argument flags is a comma separated list of the following flag names:
alloc
The section occupies space in the output file.
code
The section contains machine instructions.
contents
This flag is accepted but is ignored.
data
The section contains writeable data.
debug
The section holds debugging information.
load
The section is loadable.
noload
The section should not be loaded into memory.
readonly
The section is not writable.
rom
The section contains ROM'able contents.
share
This flag is accepted but is ignored.
=address
Set the start address of the output ELF object to the value specified by the argument address.
Only generate S-records of type “S3”. This option is only meaningful when the output target is set to “srec”.
=val
Set the maximum length of an S-record line to val. This option is only meaningful when the output target is set to “srec”.
Do not copy .dwo debug sections to the output file.
filename
Do not copy any of the symbols specified by filename to the output.
Do not copy symbols that are not needed for relocation processing.

The objcopy utility exits 0 on success, and >0 if an error occurs.

ar(1), ld(1), mcs(1), strip(1), elf(3), elftc_bfd_find_target(3), ar(5), elf(5)

The objcopy utility is expected to be option compatible with GNU objcopy.

objcopy has been implemented by Kai Wang <kaiwang27@users.sourceforge.net>.

August 30, 2017 FreeBSD-12.0