summaryrefslogtreecommitdiff
path: root/share/man/man5/a.out.5
diff options
context:
space:
mode:
Diffstat (limited to 'share/man/man5/a.out.5')
-rw-r--r--share/man/man5/a.out.557
1 files changed, 31 insertions, 26 deletions
diff --git a/share/man/man5/a.out.5 b/share/man/man5/a.out.5
index 2b0cfadbf47..eb02ff6792b 100644
--- a/share/man/man5/a.out.5
+++ b/share/man/man5/a.out.5
@@ -1,3 +1,4 @@
+.\" $OpenBSD: a.out.5,v 1.5 1998/11/26 04:25:58 aaron Exp $
.\" $NetBSD: a.out.5,v 1.8 1994/11/30 19:31:09 jtc Exp $
.\"
.\" Copyright (c) 1991, 1993
@@ -50,7 +51,7 @@ The include file
declares three structures and several macros.
The structures describe the format of
executable machine code files
-.Pq Sq binaries
+.Pq Dq binaries
on the system.
.Pp
A binary file consists of up to 7 sections.
@@ -77,7 +78,7 @@ Like the text relocation section, but for data segment pointers.
.It symbol table
Contains records used by the link editor
to cross reference the addresses of named variables and functions
-.Pq Sq symbols
+.Pq Dq symbols
between binary files.
.It string table
Contains the character strings corresponding to the symbol names.
@@ -105,39 +106,43 @@ The fields have the following functions:
This field is stored in network byte-order so that binaries for
machines with alternate byte orders can be distinguished.
It has a number of sub-components accessed by the macros
-.Dv N_GETFLAG() ,
-.Dv N_GETMID() , and
-.Dv N_GETMAGIC() ,
+.Fn N_GETFLAG ,
+.Fn N_GETMID , and
+.Fn N_GETMAGIC ,
and set by the macro
-.Dv N_SETMAGIC().
+.Fn N_SETMAGIC .
.Pp
The macro
-.Dv N_GETFLAG()
+.Fn N_GETFLAG()
returns a few flags:
.Bl -tag -width EX_DYNAMIC
.It Dv EX_DYNAMIC
-indicates that the executable requires the services of the run-time link editor.
+Indicates that the executable requires the services of the run-time link editor.
.It Dv EX_PIC
-indicates that the object contains position independent code. This flag is
+Indicates that the object contains position independent code. This flag is
set by
.Xr as 1
when given the
-.Sq -k
+.Fl k
flag and is preserved by
.Xr ld 1
if necessary.
.El
.Pp
-If both EX_DYNAMIC and EX_PIC are set, the object file is a position indendent
-executable image (eg. a shared library), which is to be loaded into the
+If both
+.Dv EX_DYNAMIC
+and
+.Dv EX_PIC
+are set, the object file is a position indendent
+executable image (e.g., a shared library), which is to be loaded into the
process address space by the run-time link editor.
.Pp
The macro
-.Dv N_GETMID()
+.Fn N_GETMID
returns the machine-id.
This indicates which machine(s) the binary is intended to run on.
.Pp
-.Dv N_GETMAGIC()
+.Fn N_GETMAGIC
specifies the magic number, which uniquely identifies binary files
and distinguishes different loading conventions.
The field must contain one of the following values:
@@ -166,7 +171,7 @@ Contains the size of the text segment in bytes.
Contains the size of the data segment in bytes.
.It Fa a_bss
Contains the number of bytes in the
-.Sq bss segment
+.Dq bss segment
and is used by the kernel to set the initial break
.Pq Xr brk 2
after the data segment.
@@ -192,7 +197,7 @@ include file defines several macros which use an
structure to test consistency or to locate section offsets in the binary file.
.Bl -tag -width N_BADMAG(exec)
.It Fn N_BADMAG exec
-Nonzero if the
+Non-zero if the
.Fa a_magic
field does not contain a recognized value.
.It Fn N_TXTOFF exec
@@ -257,12 +262,12 @@ the link editor must use a symbol address to update the pointer.
When the
.Fa r_extern
bit is clear, the relocation is
-.Sq local ;
+.Dq local ;
the link editor updates the pointer to reflect
changes in the load addresses of the various segments,
rather than changes in the value of a symbol (except when
.Fa r_baserel
-is also set (see below).
+is also set, see below).
In this case, the content of the
.Fa r_symbolnum
field is an
@@ -288,12 +293,12 @@ only occurs in shared objects.
If set, this relocation record identifies a symbol whose contents should
be copied to the location given in
.Fa r_address.
-The copying is done by the run-time link-editor from a suitable data
+The copying is done by the run-time link editor from a suitable data
item in a shared object.
.El
.Pp
Symbols map names to addresses (or more generally, strings to values).
-Since the link-editor adjusts addresses,
+Since the link editor adjusts addresses,
a symbol's name must be used to stand for its address
until an absolute value has been assigned.
Symbols consist of a fixed-length record in the symbol table
@@ -334,7 +339,7 @@ field is broken down into three sub-fields using bitmasks.
The link editor treats symbols with the
.Dv N_EXT
type bit set as
-.Sq external
+.Dq external
symbols and permits references to them from other binary files.
The
.Dv N_TYPE
@@ -346,8 +351,8 @@ The link editor must locate an external symbol with the same name
in another binary file to determine the absolute value of this symbol.
As a special case, if the
.Fa n_value
-field is nonzero and no binary file in the link-edit defines this symbol,
-the link-editor will resolve this symbol to an address
+field is non-zero and no binary file in the link-edit defines this symbol,
+the link editor will resolve this symbol to an address
in the bss segment,
reserving an amount of bytes equal to
.Fa n_value .
@@ -379,7 +384,7 @@ the other symbols from a binary file when
merging binary files.
The name of the symbol is the filename given to the link editor,
and its value is the first text address from that binary file.
-Filename symbols are not needed for link-editing or loading,
+Filename symbols are not needed for link editing or loading,
but are useful for debuggers.
.El
.Pp
@@ -437,8 +442,8 @@ is always 4 on 32-bit machines.
.Xr execve 2 ,
.Xr nlist 3 ,
.Xr core 5 ,
-.Xr stab 5 ,
-.Xr link 5
+.Xr link 5 ,
+.Xr stab 5
.Sh HISTORY
The
.Pa a.out.h