This page was produced by an automated import process, and may have formatting errors; feel free to fix.

Object File Formats

a.out

The a.out format is the original file format for Unix. It consists of three sections: text, data, and bss, which are for program code, initialized data, and uninitialized data, respectively.

The a.out format is so simple that it doesn’t have any reserved place for debugging information. (Hey, the original Unix hackers used ‘adb’, which is a machine-language debugger!) The only debugging format for a.out is stabs, which is encoded as a set of normal symbols with distinctive attributes.

The basic a.out reader is in dbxread.c. [COFF ]

COFF

The COFF format was introduced with System V Release 3 (SVR3) Unix. COFF files may have multiple sections, each prefixed by a header. The number of sections is limited.

The COFF specification includes support for debugging. Although this was a step forward, the debugging information was woefully limited. For instance, it was not possible to represent code that came from an included file. GNU’s COFF-using configs often use stabs-type info, encapsulated in special sections.

The COFF reader is in coffread.c. [ECOFF ]

ECOFF

ECOFF is an extended COFF originally introduced for Mips and Alpha workstations.

The basic ECOFF reader is in mipsread.c. [XCOFF ]

XCOFF

The IBM RS/6000 running AIX uses an object file format called XCOFF. The COFF sections, symbols, and line numbers are used, but debugging symbols are dbx-style stabs whose strings are located in the .debug section (rather than the string table). For more information, see [http://sourceware.org/gdb/current/onlinedocs/stabs/index.html#Top The Stabs Debugging Format].

The shared library scheme has a clean interface for figuring out what shared libraries are in use, but the catch is that everything which refers to addresses (symbol tables and breakpoints at least) needs to be relocated for both shared libraries and the main executable. At least using the standard mechanism this can only be done once the program has been run (or the core file has been read). [PE ]

PE

Windows 95 and NT use the PE (Portable Executable) format for their executables. PE is basically COFF with additional headers.

While BFD includes special PE support, GDB needs only the basic COFF reader. [ELF ]

ELF

The ELF format came with System V Release 4 (SVR4) Unix. ELF is similar to COFF in being organized into a number of sections, but it removes many of COFF’s limitations. Debugging info may be either stabs encapsulated in ELF sections, or more commonly these days, DWARF.

The basic ELF reader is in elfread.c. [SOM ]

SOM

SOM is HP’s object file and debug format (not to be confused with IBM’s SOM, which is a cross-language ABI).

The SOM reader is in somread.c.

None: Internals Object-File-Formats (last edited 2013-08-20 23:41:03 by StanShebs)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.