.\" Man page generated from reStructuredText. . .TH "LLVM-OBJCOPY" "1" "2019-09-13" "9" "LLVM" .SH NAME llvm-objcopy \- object copying and editing tool . .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 .. .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’s 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’s \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 Add a .gnu_debuglink section for \fB\fP to the output. .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 \-\-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\-section
, \-j Remove all sections from the output, except for sections named \fB
\fP\&. Can be specified multiple times to keep multiple sections. .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
, \-R Remove the specified section from the output. Can be specified multiple times to remove multiple sections simultaneously. .UNINDENT .INDENT 0.0 .TP .B \-\-strip\-all\-gnu Remove all symbols, debug sections and relocations from the output. This option is equivalent to GNU \fBobjcopy\fP’s \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 sections and the section name table. .sp For COFF 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 , \-N Remove all symbols named \fB\fP from the output. Can be specified multiple times to remove multiple symbols. .UNINDENT .INDENT 0.0 .TP .B \-\-strip\-symbols Remove all symbols whose names appear in the file \fB\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 ‘#’. Can be specified multiple times to read names from multiple files. .UNINDENT .INDENT 0.0 .TP .B \-\-strip\-unneeded\-symbol Remove from the output all symbols named \fB\fP that are local or undefined and are not required by any relocation. .UNINDENT .INDENT 0.0 .TP .B \-\-strip\-unneeded\-symbols Remove all symbols whose names appear in the file \fB\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 ‘#’. 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. .UNINDENT .INDENT 0.0 .TP .B \-\-version, \-V Display the version of this program. .UNINDENT .SH COFF-SPECIFIC OPTIONS .sp The following options are implemented only for COFF objects. If used with other objects, \fBllvm\-objcopy\fP will either emit an error or silently ignore them. .INDENT 0.0 .TP .B \-\-only\-keep\-debug Remove the contents of non\-debug sections from the output, but keep the section headers. .UNINDENT .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\-section Add a section named \fB
\fP with the contents of \fB\fP to the output. 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. .UNINDENT .INDENT 0.0 .TP .B \-\-add\-symbol =[
:][,] Add a new symbol called \fB\fP to the output symbol table, in the section named \fB
\fP, with value \fB\fP\&. If \fB
\fP is not specified, the symbol is added as an absolute symbol. The \fB\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 \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 llvm\-objcopy 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 \-\-binary\-architecture , \-B Specify the architecture to use, when transforming an architecture\-less format (e.g. binary) to another format. Valid options are: .INDENT 7.0 .IP \(bu 2 \fIaarch64\fP .IP \(bu 2 \fIarm\fP .IP \(bu 2 \fIi386\fP .IP \(bu 2 \fIi386:x86\-64\fP .IP \(bu 2 \fImips\fP .IP \(bu 2 \fIpowerpc:common64\fP .IP \(bu 2 \fIriscv:rv32\fP .IP \(bu 2 \fIriscv:rv64\fP .IP \(bu 2 \fIsparc\fP .IP \(bu 2 \fIsparcel\fP .IP \(bu 2 \fIx86\-64\fP .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-build\-id\-link\-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 Hard\-link the input to \fB/xx/xxx\fP, where \fB\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 Hard\-link the output to \fB/xx/xxx\fP, where \fB\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 , \-\-adjust\-start Add \fB\fP to the program’s 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 [