2020-06-27 11:56:49 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\" Man page generated from reStructuredText.
|
|
|
|
.
|
|
|
|
.
|
|
|
|
.nr rst2man-indent-level 0
|
|
|
|
.
|
|
|
|
.de1 rstReportMargin
|
|
|
|
\\$1 \\n[an-margin]
|
|
|
|
level \\n[rst2man-indent-level]
|
|
|
|
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
|
-
|
|
|
|
\\n[rst2man-indent0]
|
|
|
|
\\n[rst2man-indent1]
|
|
|
|
\\n[rst2man-indent2]
|
|
|
|
..
|
|
|
|
.de1 INDENT
|
|
|
|
.\" .rstReportMargin pre:
|
|
|
|
. RS \\$1
|
|
|
|
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
|
|
|
. nr rst2man-indent-level +1
|
|
|
|
.\" .rstReportMargin post:
|
|
|
|
..
|
|
|
|
.de UNINDENT
|
|
|
|
. RE
|
|
|
|
.\" indent \\n[an-margin]
|
|
|
|
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
|
.nr rst2man-indent-level -1
|
|
|
|
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
|
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
|
|
|
..
|
2021-04-26 11:23:24 +00:00
|
|
|
.TH "LLVM-OBJCOPY" "1" "2021-06-07" "12" "LLVM"
|
|
|
|
.SH NAME
|
|
|
|
llvm-objcopy \- object copying and editing tool
|
2020-06-27 11:56:49 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.sp
|
|
|
|
\fBllvm\-objcopy\fP [\fIoptions\fP] \fIinput\fP [\fIoutput\fP]
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.sp
|
|
|
|
\fBllvm\-objcopy\fP is a tool to copy and manipulate objects. In basic
|
|
|
|
usage, it makes a semantic copy of the input to the output. If any options are
|
|
|
|
specified, the output may be modified along the way, e.g. by removing sections.
|
|
|
|
.sp
|
|
|
|
If no output file is specified, the input file is modified in\-place. If "\-" is
|
|
|
|
specified for the input file, the input is read from the program\(aqs standard
|
|
|
|
input stream. If "\-" is specified for the output file, the output is written to
|
|
|
|
the standard output stream of the program.
|
|
|
|
.sp
|
|
|
|
If the input is an archive, any requested operations will be applied to each
|
|
|
|
archive member individually.
|
|
|
|
.sp
|
|
|
|
The tool is still in active development, but in most scenarios it works as a
|
|
|
|
drop\-in replacement for GNU\(aqs \fBobjcopy\fP\&.
|
|
|
|
.SH GENERIC AND CROSS-PLATFORM OPTIONS
|
|
|
|
.sp
|
|
|
|
The following options are either agnostic of the file format, or apply to
|
|
|
|
multiple file formats.
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-add\-gnu\-debuglink <debug\-file>
|
|
|
|
Add a .gnu_debuglink section for \fB<debug\-file>\fP to the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-add\-section <section=file>
|
|
|
|
Add a section named \fB<section>\fP with the contents of \fB<file>\fP to the
|
|
|
|
output. For ELF objects the section will be of type \fISHT_NOTE\fP, if the name
|
|
|
|
starts with ".note". Otherwise, it will have type \fISHT_PROGBITS\fP\&. Can be
|
|
|
|
specified multiple times to add multiple sections.
|
|
|
|
.sp
|
|
|
|
For MachO objects, \fB<section>\fP must be formatted as
|
|
|
|
\fB<segment name>,<section name>\fP\&.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-binary\-architecture <arch>, \-B
|
|
|
|
Ignored for compatibility.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-disable\-deterministic\-archives, \-U
|
|
|
|
Use real values for UIDs, GIDs and timestamps when updating archive member
|
|
|
|
headers.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-discard\-all, \-x
|
|
|
|
Remove most local symbols from the output. Different file formats may limit
|
|
|
|
this to a subset of the local symbols. For example, file and section symbols in
|
|
|
|
ELF objects will not be discarded.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-dump\-section <section>=<file>
|
|
|
|
Dump the contents of section \fB<section>\fP into the file \fB<file>\fP\&. Can be
|
|
|
|
specified multiple times to dump multiple sections to different files.
|
|
|
|
\fB<file>\fP is unrelated to the input and output files provided to
|
|
|
|
\fBllvm\-objcopy\fP and as such the normal copying and editing
|
|
|
|
operations will still be performed. No operations are performed on the sections
|
|
|
|
prior to dumping them.
|
|
|
|
.sp
|
|
|
|
For MachO objects, \fB<section>\fP must be formatted as
|
|
|
|
\fB<segment name>,<section name>\fP\&.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-enable\-deterministic\-archives, \-D
|
|
|
|
Enable deterministic mode when copying archives, i.e. use 0 for archive member
|
|
|
|
header UIDs, GIDs and timestamp fields. On by default.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-help, \-h
|
|
|
|
Print a summary of command line options.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-only\-keep\-debug
|
|
|
|
Produce a debug file as the output that only preserves contents of sections
|
|
|
|
useful for debugging purposes.
|
|
|
|
.sp
|
|
|
|
For ELF objects, this removes the contents of \fISHF_ALLOC\fP sections that are not
|
|
|
|
\fISHT_NOTE\fP by making them \fISHT_NOBITS\fP and shrinking the program headers where
|
|
|
|
possible.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-only\-section <section>, \-j
|
|
|
|
Remove all sections from the output, except for sections named \fB<section>\fP\&.
|
|
|
|
Can be specified multiple times to keep multiple sections.
|
|
|
|
.sp
|
|
|
|
For MachO objects, \fB<section>\fP must be formatted as
|
|
|
|
\fB<segment name>,<section name>\fP\&.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-redefine\-sym <old>=<new>
|
|
|
|
Rename symbols called \fB<old>\fP to \fB<new>\fP in the output. Can be specified
|
|
|
|
multiple times to rename multiple symbols.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-redefine\-syms <filename>
|
|
|
|
Rename symbols in the output as described in the file \fB<filename>\fP\&. In the
|
|
|
|
file, each line represents a single symbol to rename, with the old name and new
|
|
|
|
name separated by whitespace. Leading and trailing whitespace is ignored, as is
|
|
|
|
anything following a \(aq#\(aq. Can be specified multiple times to read names from
|
|
|
|
multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-regex
|
|
|
|
If specified, symbol and section names specified by other switches are treated
|
|
|
|
as extended POSIX regular expression patterns.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-remove\-section <section>, \-R
|
|
|
|
Remove the specified section from the output. Can be specified multiple times
|
|
|
|
to remove multiple sections simultaneously.
|
|
|
|
.sp
|
|
|
|
For MachO objects, \fB<section>\fP must be formatted as
|
|
|
|
\fB<segment name>,<section name>\fP\&.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-set\-section\-alignment <section>=<align>
|
|
|
|
Set the alignment of section \fB<section>\fP to \fI<align>\(ga\fP\&. Can be specified
|
|
|
|
multiple times to update multiple sections.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
2021-04-26 11:23:24 +00:00
|
|
|
.B \-\-set\-section\-flags <section>=<flag>[,<flag>,...]
|
|
|
|
Set section properties in the output of section \fB<section>\fP based on the
|
|
|
|
specified \fB<flag>\fP values. Can be specified multiple times to update multiple
|
|
|
|
sections.
|
|
|
|
.sp
|
|
|
|
Supported flag names are \fIalloc\fP, \fIload\fP, \fInoload\fP, \fIreadonly\fP, \fIexclude\fP,
|
|
|
|
\fIdebug\fP, \fIcode\fP, \fIdata\fP, \fIrom\fP, \fIshare\fP, \fIcontents\fP, \fImerge\fP and \fIstrings\fP\&. Not
|
|
|
|
all flags are meaningful for all object file formats.
|
|
|
|
.sp
|
|
|
|
For ELF objects, the flags have the following effects:
|
|
|
|
.INDENT 7.0
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIalloc\fP = add the \fISHF_ALLOC\fP flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIload\fP = if the section has \fISHT_NOBITS\fP type, mark it as a \fISHT_PROGBITS\fP
|
|
|
|
section.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIreadonly\fP = if this flag is not specified, add the \fISHF_WRITE\fP flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIexclude\fP = add the \fISHF_EXCLUDE\fP flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIcode\fP = add the \fISHF_EXECINSTR\fP flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fImerge\fP = add the \fISHF_MERGE\fP flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIstrings\fP = add the \fISHF_STRINGS\fP flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIcontents\fP = if the section has \fISHT_NOBITS\fP type, mark it as a \fISHT_PROGBITS\fP
|
|
|
|
section.
|
|
|
|
.UNINDENT
|
|
|
|
.sp
|
|
|
|
For COFF objects, the flags have the following effects:
|
|
|
|
.INDENT 7.0
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIalloc\fP = add the \fIIMAGE_SCN_CNT_UNINITIALIZED_DATA\fP and \fIIMAGE_SCN_MEM_READ\fP
|
|
|
|
flags, unless the \fIload\fP flag is specified.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fInoload\fP = add the \fIIMAGE_SCN_LNK_REMOVE\fP and \fIIMAGE_SCN_MEM_READ\fP flags.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIreadonly\fP = if this flag is not specified, add the \fIIMAGE_SCN_MEM_WRITE\fP
|
|
|
|
flag.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIexclude\fP = add the \fIIMAGE_SCN_LNK_REMOVE\fP and \fIIMAGE_SCN_MEM_READ\fP flags.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIdebug\fP = add the \fIIMAGE_SCN_CNT_INITIALIZED_DATA\fP,
|
|
|
|
\fIIMAGE_SCN_MEM_DISCARDABLE\fP and \fIIMAGE_SCN_MEM_READ\fP flags.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIcode\fP = add the \fIIMAGE_SCN_CNT_CODE\fP, \fIIMAGE_SCN_MEM_EXECUTE\fP and
|
|
|
|
\fIIMAGE_SCN_MEM_READ\fP flags.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIdata\fP = add the \fIIMAGE_SCN_CNT_INITIALIZED_DATA\fP and \fIIMAGE_SCN_MEM_READ\fP
|
|
|
|
flags.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIshare\fP = add the \fIIMAGE_SCN_MEM_SHARED\fP and \fIIMAGE_SCN_MEM_READ\fP flags.
|
|
|
|
.UNINDENT
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
2020-06-27 11:56:49 +00:00
|
|
|
.B \-\-strip\-all\-gnu
|
|
|
|
Remove all symbols, debug sections and relocations from the output. This option
|
|
|
|
is equivalent to GNU \fBobjcopy\fP\(aqs \fB\-\-strip\-all\fP switch.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-all, \-S
|
|
|
|
For ELF objects, remove from the output all symbols and non\-alloc sections not
|
|
|
|
within segments, except for .gnu.warning, .ARM.attribute sections and the
|
|
|
|
section name table.
|
|
|
|
.sp
|
|
|
|
For COFF and Mach\-O objects, remove all symbols, debug sections, and
|
|
|
|
relocations from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-debug, \-g
|
|
|
|
Remove all debug sections from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-symbol <symbol>, \-N
|
|
|
|
Remove all symbols named \fB<symbol>\fP from the output. Can be specified
|
|
|
|
multiple times to remove multiple symbols.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-symbols <filename>
|
|
|
|
Remove all symbols whose names appear in the file \fB<filename>\fP, from the
|
|
|
|
output. In the file, each line represents a single symbol name, with leading
|
|
|
|
and trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be
|
|
|
|
specified multiple times to read names from multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-unneeded\-symbol <symbol>
|
|
|
|
Remove from the output all symbols named \fB<symbol>\fP that are local or
|
|
|
|
undefined and are not required by any relocation.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-unneeded\-symbols <filename>
|
|
|
|
Remove all symbols whose names appear in the file \fB<filename>\fP, from the
|
|
|
|
output, if they are local or undefined and are not required by any relocation.
|
|
|
|
In the file, each line represents a single symbol name, with leading and
|
|
|
|
trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be specified
|
|
|
|
multiple times to read names from multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-unneeded
|
|
|
|
Remove from the output all local or undefined symbols that are not required by
|
|
|
|
relocations. Also remove all debug sections.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-version, \-V
|
|
|
|
Display the version of the \fBllvm\-objcopy\fP executable.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-wildcard, \-w
|
|
|
|
Allow wildcard syntax for symbol\-related flags. On by default for
|
|
|
|
section\-related flags. Incompatible with \-\-regex.
|
|
|
|
.sp
|
|
|
|
Wildcard syntax allows the following special symbols:
|
|
|
|
.TS
|
|
|
|
center;
|
|
|
|
|l|l|l|.
|
|
|
|
_
|
|
|
|
T{
|
|
|
|
Character
|
|
|
|
T} T{
|
|
|
|
Meaning
|
|
|
|
T} T{
|
|
|
|
Equivalent
|
|
|
|
T}
|
|
|
|
_
|
|
|
|
T{
|
|
|
|
\fB*\fP
|
|
|
|
T} T{
|
|
|
|
Any number of characters
|
|
|
|
T} T{
|
|
|
|
\fB\&.*\fP
|
|
|
|
T}
|
|
|
|
_
|
|
|
|
T{
|
|
|
|
\fB?\fP
|
|
|
|
T} T{
|
|
|
|
Any single character
|
|
|
|
T} T{
|
|
|
|
\fB\&.\fP
|
|
|
|
T}
|
|
|
|
_
|
|
|
|
T{
|
|
|
|
\fB\e\fP
|
|
|
|
T} T{
|
|
|
|
Escape the next character
|
|
|
|
T} T{
|
|
|
|
\fB\e\fP
|
|
|
|
T}
|
|
|
|
_
|
|
|
|
T{
|
|
|
|
\fB[a\-z]\fP
|
|
|
|
T} T{
|
|
|
|
Character class
|
|
|
|
T} T{
|
|
|
|
\fB[a\-z]\fP
|
|
|
|
T}
|
|
|
|
_
|
|
|
|
T{
|
|
|
|
\fB[!a\-z]\fP, \fB[^a\-z]\fP
|
|
|
|
T} T{
|
|
|
|
Negated character class
|
|
|
|
T} T{
|
|
|
|
\fB[^a\-z]\fP
|
|
|
|
T}
|
|
|
|
_
|
|
|
|
.TE
|
|
|
|
.sp
|
|
|
|
Additionally, starting a wildcard with \(aq!\(aq will prevent a match, even if
|
|
|
|
another flag matches. For example \fB\-w \-N \(aq*\(aq \-N \(aq!x\(aq\fP will strip all symbols
|
|
|
|
except for \fBx\fP\&.
|
|
|
|
.sp
|
|
|
|
The order of wildcards does not matter. For example, \fB\-w \-N \(aq*\(aq \-N \(aq!x\(aq\fP is
|
|
|
|
the same as \fB\-w \-N \(aq!x\(aq \-N \(aq*\(aq\fP\&.
|
|
|
|
.UNINDENT
|
2021-04-26 11:23:24 +00:00
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B @<FILE>
|
|
|
|
Read command\-line options and commands from response file \fI<FILE>\fP\&.
|
|
|
|
.UNINDENT
|
2020-06-27 11:56:49 +00:00
|
|
|
.SH ELF-SPECIFIC OPTIONS
|
|
|
|
.sp
|
|
|
|
The following options are implemented only for ELF objects. If used with other
|
|
|
|
objects, \fBllvm\-objcopy\fP will either emit an error or silently ignore
|
|
|
|
them.
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-add\-symbol <name>=[<section>:]<value>[,<flags>]
|
|
|
|
Add a new symbol called \fB<name>\fP to the output symbol table, in the section
|
|
|
|
named \fB<section>\fP, with value \fB<value>\fP\&. If \fB<section>\fP is not specified,
|
|
|
|
the symbol is added as an absolute symbol. The \fB<flags>\fP affect the symbol
|
|
|
|
properties. Accepted values are:
|
|
|
|
.INDENT 7.0
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIglobal\fP = the symbol will have global binding.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIlocal\fP = the symbol will have local binding.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIweak\fP = the symbol will have weak binding.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIdefault\fP = the symbol will have default visibility.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIhidden\fP = the symbol will have hidden visibility.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIprotected\fP = the symbol will have protected visibility.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIfile\fP = the symbol will be an \fISTT_FILE\fP symbol.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIsection\fP = the symbol will be an \fISTT_SECTION\fP symbol.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIobject\fP = the symbol will be an \fISTT_OBJECT\fP symbol.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIfunction\fP = the symbol will be an \fISTT_FUNC\fP symbol.
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIindirect\-function\fP = the symbol will be an \fISTT_GNU_IFUNC\fP symbol.
|
|
|
|
.UNINDENT
|
|
|
|
.sp
|
|
|
|
Additionally, the following flags are accepted but ignored: \fIdebug\fP,
|
|
|
|
\fIconstructor\fP, \fIwarning\fP, \fIindirect\fP, \fIsynthetic\fP, \fIunique\-object\fP, \fIbefore\fP\&.
|
|
|
|
.sp
|
|
|
|
Can be specified multiple times to add multiple symbols.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-allow\-broken\-links
|
|
|
|
Allow \fBllvm\-objcopy\fP to remove sections even if it would leave invalid
|
|
|
|
section references. Any invalid sh_link fields will be set to zero.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-build\-id\-link\-dir <dir>
|
|
|
|
Set the directory used by \fI\%\-\-build\-id\-link\-input\fP and
|
|
|
|
\fI\%\-\-build\-id\-link\-output\fP\&.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-build\-id\-link\-input <suffix>
|
|
|
|
Hard\-link the input to \fB<dir>/xx/xxx<suffix>\fP, where \fB<dir>\fP is the directory
|
|
|
|
specified by \fI\%\-\-build\-id\-link\-dir\fP\&. The path used is derived from the
|
|
|
|
hex build ID.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-build\-id\-link\-output <suffix>
|
|
|
|
Hard\-link the output to \fB<dir>/xx/xxx<suffix>\fP, where \fB<dir>\fP is the directory
|
|
|
|
specified by \fI\%\-\-build\-id\-link\-dir\fP\&. The path used is derived from the
|
|
|
|
hex build ID.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-change\-start <incr>, \-\-adjust\-start
|
|
|
|
Add \fB<incr>\fP to the program\(aqs start address. Can be specified multiple
|
|
|
|
times, in which case the values will be applied cumulatively.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-compress\-debug\-sections [<style>]
|
|
|
|
Compress DWARF debug sections in the output, using the specified style.
|
|
|
|
Supported styles are \fIzlib\-gnu\fP and \fIzlib\fP\&. Defaults to \fIzlib\fP if no style is
|
|
|
|
specified.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-decompress\-debug\-sections
|
|
|
|
Decompress any compressed DWARF debug sections in the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-discard\-locals, \-X
|
|
|
|
Remove local symbols starting with ".L" from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-extract\-dwo
|
|
|
|
Remove all sections that are not DWARF .dwo sections from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-extract\-main\-partition
|
|
|
|
Extract the main partition from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-extract\-partition <name>
|
|
|
|
Extract the named partition from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-globalize\-symbol <symbol>
|
|
|
|
Mark any defined symbols named \fB<symbol>\fP as global symbols in the output.
|
|
|
|
Can be specified multiple times to mark multiple symbols.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-globalize\-symbols <filename>
|
|
|
|
Read a list of names from the file \fB<filename>\fP and mark defined symbols with
|
|
|
|
those names as global in the output. In the file, each line represents a single
|
|
|
|
symbol, with leading and trailing whitespace ignored, as is anything following
|
|
|
|
a \(aq#\(aq. Can be specified multiple times to read names from multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-input\-target <format>, \-I
|
|
|
|
Read the input as the specified format. See \fI\%SUPPORTED FORMATS\fP for a list of
|
|
|
|
valid \fB<format>\fP values. If unspecified, \fBllvm\-objcopy\fP will attempt
|
|
|
|
to determine the format automatically.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-keep\-file\-symbols
|
|
|
|
Keep symbols of type \fISTT_FILE\fP, even if they would otherwise be stripped.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-keep\-global\-symbol <symbol>
|
|
|
|
Make all symbols local in the output, except for symbols with the name
|
|
|
|
\fB<symbol>\fP\&. Can be specified multiple times to ignore multiple symbols.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-keep\-global\-symbols <filename>
|
|
|
|
Make all symbols local in the output, except for symbols named in the file
|
|
|
|
\fB<filename>\fP\&. In the file, each line represents a single symbol, with leading
|
|
|
|
and trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be
|
|
|
|
specified multiple times to read names from multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-keep\-section <section>
|
|
|
|
When removing sections from the output, do not remove sections named
|
|
|
|
\fB<section>\fP\&. Can be specified multiple times to keep multiple sections.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-keep\-symbol <symbol>, \-K
|
|
|
|
When removing symbols from the output, do not remove symbols named
|
|
|
|
\fB<symbol>\fP\&. Can be specified multiple times to keep multiple symbols.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-keep\-symbols <filename>
|
|
|
|
When removing symbols from the output do not remove symbols named in the file
|
|
|
|
\fB<filename>\fP\&. In the file, each line represents a single symbol, with leading
|
|
|
|
and trailing whitespace ignored, as is anything following a \(aq#\(aq. Can be
|
|
|
|
specified multiple times to read names from multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-localize\-hidden
|
|
|
|
Make all symbols with hidden or internal visibility local in the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-localize\-symbol <symbol>, \-L
|
|
|
|
Mark any defined non\-common symbol named \fB<symbol>\fP as a local symbol in the
|
|
|
|
output. Can be specified multiple times to mark multiple symbols as local.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-localize\-symbols <filename>
|
|
|
|
Read a list of names from the file \fB<filename>\fP and mark defined non\-common
|
|
|
|
symbols with those names as local in the output. In the file, each line
|
|
|
|
represents a single symbol, with leading and trailing whitespace ignored, as is
|
|
|
|
anything following a \(aq#\(aq. Can be specified multiple times to read names from
|
|
|
|
multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-new\-symbol\-visibility <visibility>
|
|
|
|
Specify the visibility of the symbols automatically created when using binary
|
|
|
|
input or \fI\%\-\-add\-symbol\fP\&. Valid options are:
|
|
|
|
.INDENT 7.0
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIdefault\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIhidden\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIinternal\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIprotected\fP
|
|
|
|
.UNINDENT
|
|
|
|
.sp
|
|
|
|
The default is \fIdefault\fP\&.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-output\-target <format>, \-O
|
|
|
|
Write the output as the specified format. See \fI\%SUPPORTED FORMATS\fP for a list
|
|
|
|
of valid \fB<format>\fP values. If unspecified, the output format is assumed to
|
2021-04-26 11:23:24 +00:00
|
|
|
be the same as the value specified for \fI\%\-\-input\-target\fP or the input
|
|
|
|
file\(aqs format if that option is also unspecified.
|
2020-06-27 11:56:49 +00:00
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-prefix\-alloc\-sections <prefix>
|
|
|
|
Add \fB<prefix>\fP to the front of the names of all allocatable sections in the
|
|
|
|
output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-prefix\-symbols <prefix>
|
|
|
|
Add \fB<prefix>\fP to the front of every symbol name in the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-preserve\-dates, \-p
|
|
|
|
Preserve access and modification timestamps in the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-rename\-section <old>=<new>[,<flag>,...]
|
|
|
|
Rename sections called \fB<old>\fP to \fB<new>\fP in the output, and apply any
|
|
|
|
specified \fB<flag>\fP values. See \fI\%\-\-set\-section\-flags\fP for a list of
|
|
|
|
supported flags. Can be specified multiple times to rename multiple sections.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-set\-start\-addr <addr>
|
|
|
|
Set the start address of the output to \fB<addr>\fP\&. Overrides any previously
|
|
|
|
specified \fI\%\-\-change\-start\fP or \fI\%\-\-adjust\-start\fP options.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-split\-dwo <dwo\-file>
|
|
|
|
Equivalent to running \fBllvm\-objcopy\fP with \fI\%\-\-extract\-dwo\fP and
|
|
|
|
\fB<dwo\-file>\fP as the output file and no other options, and then with
|
|
|
|
\fI\%\-\-strip\-dwo\fP on the input file.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-dwo
|
|
|
|
Remove all DWARF .dwo sections from the output.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-non\-alloc
|
|
|
|
Remove from the output all non\-allocatable sections that are not within
|
|
|
|
segments.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-strip\-sections
|
|
|
|
Remove from the output all section headers and all section data not within
|
|
|
|
segments. Note that many tools will not be able to use an object without
|
|
|
|
section headers.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-target <format>, \-F
|
|
|
|
Equivalent to \fI\%\-\-input\-target\fP and \fI\%\-\-output\-target\fP for the
|
|
|
|
specified format. See \fI\%SUPPORTED FORMATS\fP for a list of valid \fB<format>\fP
|
|
|
|
values.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-weaken\-symbol <symbol>, \-W
|
|
|
|
Mark any global symbol named \fB<symbol>\fP as a weak symbol in the output. Can
|
|
|
|
be specified multiple times to mark multiple symbols as weak.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-weaken\-symbols <filename>
|
|
|
|
Read a list of names from the file \fB<filename>\fP and mark global symbols with
|
|
|
|
those names as weak in the output. In the file, each line represents a single
|
|
|
|
symbol, with leading and trailing whitespace ignored, as is anything following
|
|
|
|
a \(aq#\(aq. Can be specified multiple times to read names from multiple files.
|
|
|
|
.UNINDENT
|
|
|
|
.INDENT 0.0
|
|
|
|
.TP
|
|
|
|
.B \-\-weaken
|
|
|
|
Mark all defined global symbols as weak in the output.
|
|
|
|
.UNINDENT
|
|
|
|
.SH SUPPORTED FORMATS
|
|
|
|
.sp
|
|
|
|
The following values are currently supported by \fBllvm\-objcopy\fP for the
|
|
|
|
\fI\%\-\-input\-target\fP, \fI\%\-\-output\-target\fP, and \fI\%\-\-target\fP
|
|
|
|
options. For GNU \fBobjcopy\fP compatibility, the values are all bfdnames.
|
|
|
|
.INDENT 0.0
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIbinary\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIihex\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-i386\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-x86\-64\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-x86\-64\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-iamcu\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-littlearm\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-aarch64\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-littleaarch64\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-littleriscv\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-littleriscv\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-powerpc\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-powerpcle\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-powerpc\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-powerpcle\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-bigmips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-ntradbigmips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-ntradlittlemips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-tradbigmips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-tradlittlemips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-tradbigmips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf64\-tradlittlemips\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-sparc\fP
|
|
|
|
.IP \(bu 2
|
|
|
|
\fIelf32\-sparcel\fP
|
|
|
|
.UNINDENT
|
|
|
|
.sp
|
|
|
|
Additionally, all targets except \fIbinary\fP and \fIihex\fP can have \fI\-freebsd\fP as a
|
|
|
|
suffix.
|
|
|
|
.SH BINARY INPUT AND OUTPUT
|
|
|
|
.sp
|
|
|
|
If \fIbinary\fP is used as the value for \fI\%\-\-input\-target\fP, the input file
|
|
|
|
will be embedded as a data section in an ELF relocatable object, with symbols
|
|
|
|
\fB_binary_<file_name>_start\fP, \fB_binary_<file_name>_end\fP, and
|
|
|
|
\fB_binary_<file_name>_size\fP representing the start, end and size of the data,
|
|
|
|
where \fB<file_name>\fP is the path of the input file as specified on the command
|
|
|
|
line with non\-alphanumeric characters converted to \fB_\fP\&.
|
|
|
|
.sp
|
|
|
|
If \fIbinary\fP is used as the value for \fI\%\-\-output\-target\fP, the output file
|
|
|
|
will be a raw binary file, containing the memory image of the input file.
|
|
|
|
Symbols and relocation information will be discarded. The image will start at
|
|
|
|
the address of the first loadable section in the output.
|
|
|
|
.SH EXIT STATUS
|
|
|
|
.sp
|
|
|
|
\fBllvm\-objcopy\fP exits with a non\-zero exit code if there is an error.
|
|
|
|
Otherwise, it exits with code 0.
|
|
|
|
.SH BUGS
|
|
|
|
.sp
|
2021-04-26 11:23:24 +00:00
|
|
|
To report bugs, please visit <\fI\%https://bugs.llvm.org/\fP>.
|
2020-06-27 11:56:49 +00:00
|
|
|
.sp
|
|
|
|
There is a known issue with \fI\%\-\-input\-target\fP and \fI\%\-\-target\fP
|
|
|
|
causing only \fBbinary\fP and \fBihex\fP formats to have any effect. Other values
|
|
|
|
will be ignored and \fBllvm\-objcopy\fP will attempt to guess the input
|
|
|
|
format.
|
|
|
|
.SH SEE ALSO
|
|
|
|
.sp
|
|
|
|
\fBllvm\-strip(1)\fP
|
|
|
|
.SH AUTHOR
|
|
|
|
Maintained by the LLVM Team (https://llvm.org/).
|
|
|
|
.SH COPYRIGHT
|
2021-04-26 11:23:24 +00:00
|
|
|
2003-2021, LLVM Project
|
2020-06-27 11:56:49 +00:00
|
|
|
.\" Generated by docutils manpage writer.
|
|
|
|
.
|