📄 objcopy.html
字号:
<br><dt><code>--debugging</code>
<dd>Convert debugging information, if possible. This is not the default
because only certain debugging formats are supported, and the
conversion process can be time consuming.
<br><dt><code>--gap-fill </code><var>val</var><code></code>
<dd>Fill gaps between sections with <var>val</var>. This operation applies to
the <em>load address</em> (LMA) of the sections. It is done by increasing
the size of the section with the lower address, and filling in the extra
space created with <var>val</var>.
<br><dt><code>--pad-to </code><var>address</var><code></code>
<dd>Pad the output file up to the load address <var>address</var>. This is
done by increasing the size of the last section. The extra space is
filled in with the value specified by <code>--gap-fill</code> (default zero).
<br><dt><code>--set-start </code><var>val</var><code></code>
<dd>Set the start address of the new file to <var>val</var>. Not all object file
formats support setting the start address.
<br><dt><code>--change-start </code><var>incr</var><code></code>
<dd><dt><code>--adjust-start </code><var>incr</var><code></code>
<dd>Change the start address by adding <var>incr</var>. Not all object file
formats support setting the start address.
<br><dt><code>--change-addresses </code><var>incr</var><code></code>
<dd><dt><code>--adjust-vma </code><var>incr</var><code></code>
<dd>Change the VMA and LMA addresses of all sections, as well as the start
address, by adding <var>incr</var>. Some object file formats do not permit
section addresses to be changed arbitrarily. Note that this does not
relocate the sections; if the program expects sections to be loaded at a
certain address, and this option is used to change the sections such
that they are loaded at a different address, the program may fail.
<br><dt><code>--change-section-address </code><var>section</var><code>{=,+,-}</code><var>val</var><code></code>
<dd><dt><code>--adjust-section-vma </code><var>section</var><code>{=,+,-}</code><var>val</var><code></code>
<dd>Set or change both the VMA address and the LMA address of the named
<var>section</var>. If <code>=</code> is used, the section address is set to
<var>val</var>. Otherwise, <var>val</var> is added to or subtracted from the
section address. See the comments under <code>--change-addresses</code>,
above. If <var>section</var> does not exist in the input file, a warning will
be issued, unless <code>--no-change-warnings</code> is used.
<br><dt><code>--change-section-lma </code><var>section</var><code>{=,+,-}</code><var>val</var><code></code>
<dd>Set or change the LMA address of the named <var>section</var>. The LMA
address is the address where the section will be loaded into memory at
program load time. Normally this is the same as the VMA address, which
is the address of the section at program run time, but on some systems,
especially those where a program is held in ROM, the two can be
different. If <code>=</code> is used, the section address is set to
<var>val</var>. Otherwise, <var>val</var> is added to or subtracted from the
section address. See the comments under <code>--change-addresses</code>,
above. If <var>section</var> does not exist in the input file, a warning
will be issued, unless <code>--no-change-warnings</code> is used.
<br><dt><code>--change-section-vma </code><var>section</var><code>{=,+,-}</code><var>val</var><code></code>
<dd>Set or change the VMA address of the named <var>section</var>. The VMA
address is the address where the section will be located once the
program has started executing. Normally this is the same as the LMA
address, which is the address where the section will be loaded into
memory, but on some systems, especially those where a program is held in
ROM, the two can be different. If <code>=</code> is used, the section address
is set to <var>val</var>. Otherwise, <var>val</var> is added to or subtracted
from the section address. See the comments under
<code>--change-addresses</code>, above. If <var>section</var> does not exist in
the input file, a warning will be issued, unless
<code>--no-change-warnings</code> is used.
<br><dt><code>--change-warnings</code>
<dd><dt><code>--adjust-warnings</code>
<dd>If <code>--change-section-address</code> or <code>--change-section-lma</code> or
<code>--change-section-vma</code> is used, and the named section does not
exist, issue a warning. This is the default.
<br><dt><code>--no-change-warnings</code>
<dd><dt><code>--no-adjust-warnings</code>
<dd>Do not issue a warning if <code>--change-section-address</code> or
<code>--adjust-section-lma</code> or <code>--adjust-section-vma</code> is used, even
if the named section does not exist.
<br><dt><code>--set-section-flags </code><var>section</var><code>=</code><var>flags</var><code></code>
<dd>Set the flags for the named section. The <var>flags</var> argument is a
comma separated string of flag names. The recognized names are
<code>alloc</code>, <code>contents</code>, <code>load</code>, <code>noload</code>,
<code>readonly</code>, <code>code</code>, <code>data</code>, <code>rom</code>, <code>share</code>, and
<code>debug</code>. You can set the <code>contents</code> flag for a section which
does not have contents, but it is not meaningful to clear the
<code>contents</code> flag of a section which does have contents-just remove
the section instead. Not all flags are meaningful for all object file
formats.
<br><dt><code>--add-section </code><var>sectionname</var><code>=</code><var>filename</var><code></code>
<dd>Add a new section named <var>sectionname</var> while copying the file. The
contents of the new section are taken from the file <var>filename</var>. The
size of the section will be the size of the file. This option only
works on file formats which can support sections with arbitrary names.
<br><dt><code>--rename-section </code><var>oldname</var><code>=</code><var>newname</var><code>[,</code><var>flags</var><code>]</code>
<dd>Rename a section from <var>oldname</var> to <var>newname</var>, optionally
changing the section's flags to <var>flags</var> in the process. This has
the advantage over usng a linker script to perform the rename in that
the output stays as an object file and does not become a linked
executable.
<p>This option is particularly helpful when the input format is binary,
since this will always create a section called .data. If for example,
you wanted instead to create a section called .rodata containing binary
data you could use the following command line to achieve it:
<pre class="smallexample"> objcopy -I binary -O <output_format> -B <architecture> \
--rename-section .data=.rodata,alloc,load,readonly,data,contents \
<input_binary_file> <output_object_file>
</pre>
<br><dt><code>--change-leading-char</code>
<dd>Some object file formats use special characters at the start of
symbols. The most common such character is underscore, which compilers
often add before every symbol. This option tells <code>objcopy</code> to
change the leading character of every symbol when it converts between
object file formats. If the object file formats use the same leading
character, this option has no effect. Otherwise, it will add a
character, or remove a character, or change a character, as
appropriate.
<br><dt><code>--remove-leading-char</code>
<dd>If the first character of a global symbol is a special symbol leading
character used by the object file format, remove the character. The
most common symbol leading character is underscore. This option will
remove a leading underscore from all global symbols. This can be useful
if you want to link together objects of different file formats with
different conventions for symbol names. This is different from
<code>--change-leading-char</code> because it always changes the symbol name
when appropriate, regardless of the object file format of the output
file.
<br><dt><code>--srec-len=</code><var>ival</var><code></code>
<dd>Meaningful only for srec output. Set the maximum length of the Srecords
being produced to <var>ival</var>. This length covers both address, data and
crc fields.
<br><dt><code>--srec-forceS3</code>
<dd>Meaningful only for srec output. Avoid generation of S1/S2 records,
creating S3-only record format.
<br><dt><code>--redefine-sym </code><var>old</var><code>=</code><var>new</var><code></code>
<dd>Change the name of a symbol <var>old</var>, to <var>new</var>. This can be useful
when one is trying link two things together for which you have no
source, and there are name collisions.
<br><dt><code>--weaken</code>
<dd>Change all global symbols in the file to be weak. This can be useful
when building an object which will be linked against other objects using
the <code>-R</code> option to the linker. This option is only effective when
using an object file format which supports weak symbols.
<br><dt><code>--keep-symbols=</code><var>filename</var><code></code>
<dd>Apply <code>--keep-symbol</code> option to each symbol listed in the file
<var>filename</var>. <var>filename</var> is simply a flat file, with one symbol
name per line. Line comments may be introduced by the hash character.
This option may be given more than once.
<br><dt><code>--strip-symbols=</code><var>filename</var><code></code>
<dd>Apply <code>--strip-symbol</code> option to each symbol listed in the file
<var>filename</var>. <var>filename</var> is simply a flat file, with one symbol
name per line. Line comments may be introduced by the hash character.
This option may be given more than once.
<br><dt><code>--keep-global-symbols=</code><var>filename</var><code></code>
<dd>Apply <code>--keep-global-symbol</code> option to each symbol listed in the
file <var>filename</var>. <var>filename</var> is simply a flat file, with one
symbol name per line. Line comments may be introduced by the hash
character. This option may be given more than once.
<br><dt><code>--localize-symbols=</code><var>filename</var><code></code>
<dd>Apply <code>--localize-symbol</code> option to each symbol listed in the file
<var>filename</var>. <var>filename</var> is simply a flat file, with one symbol
name per line. Line comments may be introduced by the hash character.
This option may be given more than once.
<br><dt><code>--weaken-symbols=</code><var>filename</var><code></code>
<dd>Apply <code>--weaken-symbol</code> option to each symbol listed in the file
<var>filename</var>. <var>filename</var> is simply a flat file, with one symbol
name per line. Line comments may be introduced by the hash character.
This option may be given more than once.
<br><dt><code>--alt-machine-code=</code><var>index</var><code></code>
<dd>If the output architecture has alternate machine codes, use the
<var>index</var>th code instead of the default one. This is useful in case
a machine is assigned an official code and the tool-chain adopts the
new code, but other applications still depend on the original code
being used.
<br><dt><code>-V</code>
<dd><dt><code>--version</code>
<dd>Show the version number of <code>objcopy</code>.
<br><dt><code>-v</code>
<dd><dt><code>--verbose</code>
<dd>Verbose output: list all object files modified. In the case of
archives, <code>objcopy -V</code> lists all members of the archive.
<br><dt><code>--help</code>
<dd>Show a summary of the options to <code>objcopy</code>.
</dl>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -