Contents|Index|Previous|Next

binutils, the GNU binary utilities

The following are the binary utilities, although they are not included on all hosts: ar, nm, objcopy, objdump, ranlib, size, strings, and strip.

For more information on binutils, see The GNU Binary Utilities in GNUPro Utilities.

The most important of these utilities are objcopy and objdump.

objcopy

A few ROM monitors, such as a.out, load executable binary images, and, consequently, most load an S-record. An S-record is a printable ASCII representation of an executable binary image.

S-records are suitable both for building ROM images for standalone boards and for downloading images to embedded systems. Use the following example’s input for this process.

    objcopy -O srec infile outfile

infile in the previous example’s input is the executable binary filename, and outfile is the filename for the S-record.

Most PROM burners also read S-records or some similar format. Use the following example’s input to get a list of supported object file types for your architecture.

    objdump -i

For more information on S-records, see the discussions for FORMAT output-format in MRI Comaptible Files and the general discussion in BFD in Using LD in GNUPro Utilities. For more discussion of making an executable binary image, see objcopy in The GNU Binary Utilitiesin GNUPro Utilities.

objdump

objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work.

When specifying archives, objdump shows information on each of the member object files. objfile... are the object files to be examined.

A few of the more useful options for commands are: -d, -disassemble and -prefix-addresses.

-d
--disassemble

Displays the aseembler mnemonics for the machine instructions from objfile. This option only disassembles those sections that are expected to contain instructions.

--prefix-addresses

For disassembling, prints the complete address on each line, starting each output line with the address it's disassembling. This is the older disassembly format. Otherwise, you only get raw opcodes.