Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ a.out(5) — HP-UX 5.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chatr(1)

ld(1)

nm(1)

strip(1)

magic(5)

A.OUT(5)  —  Series 500 Implementation

NAME

a.out − executable linker output file

HP-UX COMPATIBILITY

Level: HP-UX/RUN ONLY

Origin: HP

Remarks: This manual entry describes the a.out file format for the Series 500.  Refer to other a.out manual pages for information valid for other implementations. 

DESCRIPTION

A.out is the output file of the linker ld(1).  Ld will make a.out executable if there are no errors during compilation and linking, and no unresolved external references. 

This file has five sections − a file header, a segment table, a segment information section, a symbol table(s) section, and a name pool(s) section.  It looks as follows: Note that the above pictorial representation represents the logical order of the file, not necessarily the physical order.  A description of each section of the file follows. 

File Header

The a.out file header is conceptually divided into two pieces.  The first is a section of "scalar" values, and the second is a "file map" containing data pertaining to the rest of the file.  The entire file header is made up of 128 bytes of information, 32 of which make up the scalar section.  The following is a pictorial representation of the scalar section:
Each horizontal "slice" represents a word made up of four eight-bit bytes. The first word is called the "magic number", which is made up of two half-words called the system ID and the file type.  The system ID identifies the target machine upon which the object code will run.  The file type specifies whether or not the file is executable (hex 107), shareable (hex 108), or relocatable (hex 106).

The third word is used to specify the settings of three flags.  The left-most three bits of this word are significant; the remainder of the word is ignored.  Bit 1, the left-most of the flag bits, marks the program as using a single data segment, if set.  You can override this with the −T or −A ld options, which force the program to reside in one or two data segments, respectively.  Bit 2 marks the file as relinkable, if set (meaning that the file contains relocation records and a symbol table).  Bit 3 marks the file as debuggable, if set. 

The Program Entry Point word contains an external program pointer (EPP) referencing the starting code for the program.  Ld normally assigns the starting address of the main program to this word.  This can be changed with the −e linker option. 

The Version Stamp is a user-supplied 32-bit integer which is used to distinguish one version of an application program from another.  The user can specify this integer using the −V ld(1) option at link time. 

The file map portion of the header looks as follows:
Each offset entry in the file map shows where the given section starts, relative to the beginning of the a.out file.  Each size entry gives the size, in bytes, for that section. 

Segment Table

The segment table collects, in one place, all information about the code and data segments making up the program.  The segment table consists of an array of entries.  Each entry describes one code or data segment of the program. 

The following information is given for both code and data segment table entries:

a segment name, which consists of an offset into the name pool, relative to the beginning of the name pool.  This is useful for symbolically referring to code or data segments (not currently implemented). 

a segment type, which specifies one of three possible types of segments − code, direct data (in GDS), or indirect data (in GDS or EDS). 

a list of segment attributes.  The segments can be paged, virtual, demand loadable, writable, and privileged.  The linker sets the attributes for executable files. 

a segment offset, which references a particular code or data segment within the segment image area.  The reference is given relative to the beginning of the segment image area. 

a segment size, which is the size, in bytes, of the particular code or data segment being described in the entry. 

a segment fixup size, which specifies the size, in bytes, of the loader fixup area in the particular segment being described. 

a segment relocation information size, which specifies the number of bytes of relocation records for this segment. 

The following information is given for data segment table entries only:

a segment limit, which specifies the maximum number of bytes that the indirect data segment can contain.  Attempting to increase the size beyond this stated limit results in an error.  The linker assigns a default value of 1.5 megabytes to this field, but it may be changed with the −m chatr(1) option. 

a segment zero-padding size, which is a byte count of the uninitialized data area.  The linker computes this value from the data relocation records. 

The following information is given for code segment table entries only:

a segment local procedures count, which specifies the number of procedures defined in that segment, but only known locally within it. 

a segment external procedures count, which specifies the number of procedures defined in that segment, but externally known. 

Several words are left unused in each segment table entry to allow for future growth. 

Segment Information

This section of the file contains the segment images for each segment included in the final, executable file.  This section contains a subsection for each program segment.  Each subsection is in turn made up of three parts − the contents of the segment (code or data), a list of pointers that the loader must "fix up" in that segment, and the relocation records for that segment.  Each subsection looks as follows:
The code image contains the compiled machine code for each program segment. The data image contains an image of initialized data for the program. Contained in this code are pointers. The loader fixup information area contains offsets that reference these pointers (the offsets are given relative to the beginning of the code/data image area). These offsets must be "fixed up" at run time (i.e., the program loader exec must update the segment number fields with the correct values).  The linker generates the loader fixup information. 

Symbol Tables

The linker symbol table contains data on relocatable symbols relevant to the linker (e.g. name and type for each global symbol).  Refer to nm(1) (Series 500 only) for a complete description of each symbol type and the parameters associated with them.  The contents of the symbol table may be listed in several different ways with nm. 

Name Pool

The name pool contains a list of null-terminated strings, which specify the names of the symbols in the program.  The symbol table entries contain indexes into the name pool instead of the names themselves.  This permits arbitrarily long names to be used instead of fixed-length names.  The first string in the name pool is always a null string.  This enables zero to be used as an index into the name pool for entities which have no names. 

SEE ALSO

chatr(1), ld(1), nm(1), strip(1), magic(5). 

Hewlett-Packard  —  last mod. May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026