A.out (file format)
Encyclopedia
a.out is a file format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...

 used in older versions of Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 computer operating systems for executable
Executable
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...

s, object code
Object code
Object code, or sometimes object module, is what a computer compiler produces. In a general sense object code is a sequence of statements in a computer language, usually a machine code language....

, and, in later systems, shared libraries. The name stands for assembler output.

a.out remains the default output file name for executables created by certain compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

s/linkers when no output name is specified, even though these executables are no longer in the a.out format.

Use

An a.out format for the PDP-7
PDP-7
The DEC PDP-7 is a minicomputer produced by Digital Equipment Corporation. Introduced in 1965, it was the first to use their Flip-Chip technology. With a cost of only $72,000 USD, it was cheap but powerful by the standards of the time. The PDP-7 was the third of Digital's 18-bit machines, with...

, similar to the a.out format used on the PDP-11
PDP-11
The PDP-11 was a series of 16-bit minicomputers sold by Digital Equipment Corporation from 1970 into the 1990s, one of a succession of products in the PDP series. The PDP-11 replaced the PDP-8 in many real-time applications, although both product lines lived in parallel for more than 10 years...

, appeared in the first edition of UNIX.
It was superseded by the COFF
COFF
The Common Object File Format is a specification of a format for executable, object code, and shared library computer files used on Unix systems...

 format in AT&T Unix System V
UNIX System V
Unix System V, commonly abbreviated SysV , is one of the first commercial versions of the Unix operating system. It was originally developed by American Telephone & Telegraph and first released in 1983. Four major versions of System V were released, termed Releases 1, 2, 3 and 4...

, which was in turn superseded by the ELF
Executable and Linkable Format
In computing, the Executable and Linkable Format is a common standard file format for executables, object code, shared libraries, and core dumps. First published in the System V Application Binary Interface specification, and later in the Tool Interface Standard, it was quickly accepted among...

 format in System V Release 4.

Though Berkeley Unix
Berkeley Software Distribution
Berkeley Software Distribution is a Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995...

 continued using the a.out format for some time, modern BSD-systems have since switched to ELF. NetBSD/i386
NetBSD
NetBSD is a freely available open source version of the Berkeley Software Distribution Unix operating system. It was the second open source BSD descendant to be formally released, after 386BSD, and continues to be actively developed. The NetBSD project is primarily focused on high quality design,...

 switched formally from a.out to ELF in its 1.5 release. FreeBSD/i386
FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...

 switched to ELF during the 2.2 to 3.0 transition.

The a.out support for debug
Debugger
A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator , a technique that allows great power in its ability to halt when specific conditions are encountered but which...

 information is done through the use of special entries in the symbol table called stabs
Stabs
stabs is a debugging data format for storing information about computer programs for use by symbolic and source-level debuggers...

. The stabs format has also been used in many COFF
COFF
The Common Object File Format is a specification of a format for executable, object code, and shared library computer files used on Unix systems...

 and ELF
Executable and Linkable Format
In computing, the Executable and Linkable Format is a common standard file format for executables, object code, shared libraries, and core dumps. First published in the System V Application Binary Interface specification, and later in the Tool Interface Standard, it was quickly accepted among...

 variations.

Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 also used a.out until kernel 1.2 (ELF support was added in the experimental 1.1.52), when it was superseded by ELF for that platform as well.
Linux's transition to ELF was more or less forced due to the complex nature of building a.out shared libraries on that platform, which included the need to register the virtual address space at which the library was located with a central authority, as the a.out ld.so in Linux was unable to relocate shared libraries.
The various BSD flavours were able to continue using a.out binaries long after Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 was forced to switch to ELF, due to the somewhat more flexible nature of the BSD a.out format compared to that of Linux. MINIX 3
MINIX 3
MINIX 3 is a project to create a small, highly reliable and functional Unix-like operating system. It is published under the BSD license.The main goal of the project is for the system to be fault-tolerant by detecting and repairing its own faults on the fly, without user intervention...

 still uses a.out as its binary format, but it does not support shared libraries.

Format

a.out executables typically came in one of several variants: OMAGIC, NMAGIC, QMAGIC, or ZMAGIC.
OMAGIC
The OMAGIC format had contiguous segments after the header, with no separation of text and data. This format was also used as object file format.

NMAGIC
The NMAGIC format was similar to OMAGIC, however the data segment was loaded on the immediate next page after the end of the text segment, and the text segment was marked read-only.

ZMAGIC
The ZMAGIC format added support for demand paging. The length of the code and data segments in the file had to be multiples of the page size.

QMAGIC
QMAGIC binaries were typically loaded one page above the bottom of the virtual address space, in order to permit trapping of null pointer dereferences via a segmentation fault. The a.out header was merged with the first page of the text segment, typically saving a page worth of memory

CMAGIC
Old versions of Linux use this format for core dumps
Core dump
In computing, a core dump consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally...

.


An a.out file consists of up to seven sections, in the following order:

exec header
Contains parameters used by the kernel to load a binary file into memory and execute it, and by the link editor ld
Ld (Unix)
GNU linker is the GNU Project's implementation of the Unix command ld. GNU ld runs the linker, which creates an executable file from object files created during compilation of a software project. A linker script may be passed to GNU ld to exercise greater control over the linking process...

 to combine a binary file with other binary files. This section is the only mandatory one.

text segment
Contains machine code and related data that are loaded into memory when a program executes. May be loaded read-only.

data segment
Contains initialized data; always loaded into writable memory.

text relocations
Contains records used by the link editor to update pointers in the text segment when combining binary files.

data relocations
Like the text relocation section, but for data segment pointers.

symbol table
Contains records used by the link editor to cross-reference the addresses of named variables and functions (symbols) between binary files.

string table
Contains the character strings corresponding to the symbol names.

See also

  • Comparison of executable file formats
    Comparison of executable file formats
    This is a comparison of executable file formats.Among the above formats, the ones in most common use are PE , ELF and Mach-O .- References :...

  • Portable Executable
    Portable Executable
    The Portable Executable format is a file format for executables, object code and DLLs, used in 32-bit and 64-bit versions of Windows operating systems. The term "portable" refers to the format's versatility in numerous environments of operating system software architecture...

  • ELF
    Executable and Linkable Format
    In computing, the Executable and Linkable Format is a common standard file format for executables, object code, shared libraries, and core dumps. First published in the System V Application Binary Interface specification, and later in the Tool Interface Standard, it was quickly accepted among...

  • Vasm
    Vasm
    vasm is a free assembler supporting various CPUs and many different output formats.CPUs officially supported by vasm include M680x0 family, ColdFire family, 80x86 family, PowerPC, ARM family, Z80 family, C16x/ST10, 6502 etc. Vasm supports Standard MIT , Motorola/Freescale 68k and Old 8-bit style...

    , a free assembler

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK