.pa 1
.he 'LD (I)'3/15/72'LD (I)'
.ti 0
NAME		ld  --  link editor
.sp
.ti 0
SYNOPSIS	ld__ [ -sulxr______ ] name\d1\u ...
.sp
.ti 0
DESCRIPTION	ld__  combines several
object programs into one; resolves external
references; and searches libraries.
In the simplest case the names of several object
programs are given, and ld__ combines them, producing
an object module which can be either executed or
become the input for a further ld__ run.
In the latter case, the "-r" option must be given
to preserve the relocation bits.
.sp
The argument routines are concatenated in the order
specified.  The entry point of the output is the
beginning of the first routine.
.sp
If any argument is a library, it is searched exactly once.
Only those routines defining an unresolved external
reference are loaded.
If a routine from a library
references another routine in the library,
the referenced routine must appear after the
referencing routine in the library.
Thus the order of programs within libraries
is important.
.sp
ld__ understands several flag arguments which are written
preceded by a "-":
.sp
.in +6
.ti -3
-s "squash" the output, that is, remove the symbol table
and relocation bits to save space (but impair the
usefulness of the debugger).
This information can also be removed by strip_____.
.ti -3
.sp
-u take the following argument as a symbol and enter
it as undefined in the symbol table.  This is useful
for loading wholly from a library, since initially the symbol
table is empty and an unresolved reference is needed
to force the loading of the first routine.
.sp
.ti -3
-l This option is an abbreviation for a library name.
"-l" alone stands for "/usr/lib/liba.a", which
is the standard system library for assembly language
programs.
"-lx" stands for "/usr/lib/libx.a" where x is any character.
There are libraries for Fortran (x="f"), C (x="c"), Explor (x="e") and B (x="b").

.ti -3
-x Do not preserve local
(non-.globl) symbols in the output symbol table; only enter
external symbols.
This option saves some space in the output file.

.ti -3
-r generate relocation bits in the output file
so that it can be the subject of another ld__ run.
.sp
.in -6
The output of ld__ is left on a.out_____.  This file is executable
only if no errors occurred during the load.
.sp
.ti 0
FILES		/usr/lib/lib?.a	libraries
.br
a.out	output file
.sp
.ti 0
SEE ALSO	as(I), ar(I)
.sp
.ti 0
DIAGNOSTICS	"file
not found"-- bad argument
.sp
"bad format"-- bad argument
.sp
"relocation error"-- bad argument (relocation
bits corrupted)
.sp
"multiply defined"-- same symbol defined twice in same load
.sp
"un"-- stands for "undefined symbol"

"symbol not found"--  loader bug

"can't move output file"-- can't move temporary to a.out file

"no relocation bits"-- an input file lacks relocation information

"too many symbols"-- too many references to external
symbols in a given routine

"premature EOF"

"can't create l.out"-- cannot make temporary file

"multiple entry point"-- more than one entry point
specified (not possible yet).
.sp
.ti 0
BUGS		--
