objcopy [options] infile [outfile]

Copy the contents of the input object file to another file, optionally changing the file format in the process (but not the endian-ness). If outfile is not specified, objcopy creates a temporary file and renames it to infile when the copy is complete, destroying the original input file. The GNU Binary File Descriptor (BFD) library is used to read and write the object files.


--add-section section = file

Add a new section to the output object file with the specified section name and the contents taken from the specified file. Available only for formats that allow arbitrarily named sections.

--alt-machine-code= n

If the output architecture has alternate machine codes, use the nth code instead of the default.

-b n, --byte= n

Copy only every nth byte. Header data is not affected. The value of n can be from 0 to interleave-1, where interleave is specified by -i (default is 4). This option is useful for creating files to program ROM and is typically used with srec as the output format.

-B bfdarch, --binary-architecture= bfdarch

Set the output architecture to bfdarch (e.g., i386) for transforming a raw binary file into an object file. Otherwise, this option is ignored. After the conversion, your program can access data inside the created object file by referencing the special symbols _binary_objfile_start, _binary_objfile_end, and _binary_objfile_size.

--change-addresses= incr, --adjust-vma= incr

Change the VMA and LMA addresses ...

Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.