Mach-O.5   [plain text]


.TH MACH-O 5 "January 10, 1990" "Apple Computer, Inc."
.SH NAME
Mach-O \- Mach-O assembler and link editor output
.SH SYNOPSIS
.nf
.B #include <sys/loader.h>
.B #include <nlist.h>
.B #include <stab.h>
.B #include <reloc.h>
.fi
.SH DESCRIPTION
The object files produced by the assembler and link editor are in Mach-O
(Mach object) file format.
The file name
.I a.out
is the default output file name of the assembler
.IR as (1)
and the link editor
.IR ld (1)
.
The format of the object file however is not 4.3BSD a.out format as the
name suggests, but rather Mach-O format.
The link editor will make
.I a.out
executable if the resulting format is an executable type and there were no
errors and no unresolved external references.
.PP
The complete description of a Mach-O file is given in a number of include files.
The file <sys/loader.h> describes the headers, <nlist.h> describes the symbol
table entries with <stab.h> supplementing it, and <reloc.h> describes the
relocation entries.
.PP
The actual instructions and data used by the program represented by a Mach-O
file are the contents of its sections.  Sections are grouped together in
segments.  Each section carries with it, in its header, the information as to
which segment it belongs in.  When a file type that is executable is created
the sections are placed in their proper segment and all the segment headers are
created and the segments themselves are padded out to the segment alignment
(typically the target pagesize).
For the object file type produced by an assembler (or by the link editor for further
linking) all the sections are placed in one segment for compactness.
.PP
When the kernel executes a Mach-O file it maps in the object file's segments,
any segments from fixed virtual shared libraries that the object uses and
creates the thread(s) for execution.  Any part of the object file that is not
part of a segment is not mapped in for execution and except for the headers
is not needed to execute the file.  These parts include the relocation entries,
the symbol table and the string table.  These parts can however be mapped in
with the use of the link editor's
.B \-seglinkedit
option which creates a segment that contains these parts.
These parts can be stripped with the
.B \-s
option to 
.IR ld (1)
or
.IR strip (1).
.PP
.\"For more information, see Chapter 8, "Mach Object Files," in the
.\"\fINeXT Development Tools\fR manual.
.SH "SEE ALSO"
as(1), ld(1), nm(1), gdb(1), stab(5), strip(1)