HP-UX Reference (11i v2 03/08) - 4 File Formats (vol 8)

a
a.out(4) a.out(4)
the sum of the next maximal page boundary past the end of text plus the remainder of the last text
address divided by the maximal page size. If the last text address is a multiple of the maximal page size,
no duplication is necessary. The stack is automatically extended as required. The data segment is
extended as requested by the brk(2) system call.
SOM a.out (PA-RISC Only)
The file name
a.out is the default file name for the output file from the assembler (see as(1)), compilers,
and the linker (see ld(1)). The assembler and compilers create relocatable object files, ready for input to
the linker. The linker creates executable object files and shared library files.
An object file consists of a file header, auxiliary headers, space dictionary, subspace dictionary, symbol
table, relocation information, compiler records, space string table, symbol string table, and the data for
initialized code and data. Not all of these sections are required for all object files. The file must begin
with the file header, but the remaining sections do not have to be in any particular order; the file header
contains pointers to each of the other sections of the file.
A relocatable object file, created by the assembler or compiler, must contain at least the following sec-
tions: file header, space dictionary, subspace dictionary, symbol table, relocation information, space
string table, symbol string table, and code and data. It may also contain auxiliary headers and compiler
records. Relocatable files generally contain unresolved symbols. The linker combines relocatable files
and searches libraries to produce an executable file. The linker can also be used to combine relocatable
files and produce a new relocatable file as output, suitable for input to a subsequent linker run.
An executable file, created by the linker, typically contains the following sections: file header, an HP-UX
auxiliary header, space dictionary, subspace dictionary, symbol table, space string table, symbol string
table, and code and data. The linker also copies any auxiliary headers and compiler records from the
input files to the output file. If the file has been stripped (see strip (1)), it will not contain a symbol table,
symbol string table, or compiler records. An executable file must not contain any unresolved symbols.
A shared library file, created by the linker, contains the same sections found in an executable file, with
additional information added to the code section of the file. This additional information contains a
header, export table, import table, and dynamic relocation records to be used by the dynamic loader.
Programs consist of two loadable spaces: a shared, non-writable, code space named
$TEXT$; and a
private, writable, data space named
$PRIVATE$. A program may contain another loadable, private
space named $THREAD_SPECIFIC$
. A program may contain other unloadable spaces that contain data
needed by development tools. For example, symbolic debugging information is contained in a space
named
$DEBUG$ or $PINFO$. The linker treats loadable and unloadable spaces exactly the same, so
the full generality of symbol resolution and relocation is available for the symbolic debugging informa-
tion.
Spaces have an addressing range of 4,294,967,296 (2ˆ32) bytes. Each loadable space is divided into four
1,073,741,824 (2ˆ30) byte quadrants. The HP-UX operating system places all code in the first quadrant of
the
$TEXT$ space, all data in the second quadrant of the $PRIVATE$ space, and all shared library code
in the third quadrant of shared memory space.
Each space is also divided into logical units called subspaces. When the linker combines relocatable
object files, it groups all subspaces from the input files by name, then arranges the groups within the
space by a sort key associated with each subspace. Subspaces are not architecturally significant; they
merely provide a mechanism for combining individual parts of spaces independently from many input
files. Some typical subspaces in a program are shown in the following table:
$SHLIB_INFO$ Information needed for dynamic loading
$MILLICODE$ Code for millicode routines
$LIT$ Sharable literals
$CODE$ Code
$UNWIND$ Stack unwind information
$GLOBAL$ Outer block declarations for Pascal
$DATA$ Static initialized data
$COMMON$ FORTRAN common
$BSS$ Uninitialized data
$TBSS$ Thread local storage
Subspaces can be initialized or uninitialized (although typically, only
$BSS$ and $TBSS$ are uninitial-
ized). The subspace dictionary entry for an initialized subspace contains a file pointer to the initialization
data, while the entry for an uninitialized subspace contains only a 32-bit pattern used to initialize the
entire area at load time.
HP-UX 11i Version 2: August 2003 2 Hewlett-Packard Company Section 43