Research V3 development
[unix-history] / man / man1 / ld.1
CommitLineData
3cc4e5af
DR
1.pa 1
2.he 'LD (I)'3/15/72'LD (I)'
3.ti 0
4NAME ld -- link editor
5.sp
6.ti 0
7SYNOPSIS ld\b\b__ [ -sulxr\b\b\b\b\b\b______ ] name\d1\u ...
8.sp
9.ti 0
10DESCRIPTION ld\b\b__ combines several
11object programs into one; resolves external
12references; and searches libraries.
13In the simplest case the names of several object
14programs are given, and ld\b\b__ combines them, producing
15an object module which can be either executed or
16become the input for a further ld\b\b__ run.
17In the latter case, the "-r" option must be given
18to preserve the relocation bits.
19.sp
20The argument routines are concatenated in the order
21specified. The entry point of the output is the
22beginning of the first routine.
23.sp
24If any argument is a library, it is searched exactly once.
25Only those routines defining an unresolved external
26reference are loaded.
27If a routine from a library
28references another routine in the library,
29the referenced routine must appear after the
30referencing routine in the library.
31Thus the order of programs within libraries
32is important.
33.sp
34ld\b\b__ understands several flag arguments which are written
35preceded by a "-":
36.sp
37.in +6
38.ti -3
39-s "squash" the output, that is, remove the symbol table
40and relocation bits to save space (but impair the
41usefulness of the debugger).
42This information can also be removed by strip\b\b\b\b\b_____.
43.ti -3
44.sp
45-u take the following argument as a symbol and enter
46it as undefined in the symbol table. This is useful
47for loading wholly from a library, since initially the symbol
48table is empty and an unresolved reference is needed
49to force the loading of the first routine.
50.sp
51.ti -3
52-l This option is an abbreviation for a library name.
53"-l" alone stands for "/usr/lib/liba.a", which
54is the standard system library for assembly language
55programs.
56"-lx" stands for "/usr/lib/libx.a" where x is any character.
57There are libraries for Fortran (x="f"), C (x="c"), Explor (x="e") and B (x="b").
58
59.ti -3
60-x Do not preserve local
61(non-.globl) symbols in the output symbol table; only enter
62external symbols.
63This option saves some space in the output file.
64
65.ti -3
66-r generate relocation bits in the output file
67so that it can be the subject of another ld\b\b__ run.
68.sp
69.in -6
70The output of ld\b\b__ is left on a.out\b\b\b\b\b_____. This file is executable
71only if no errors occurred during the load.
72.sp
73.ti 0
74FILES /usr/lib/lib?.a libraries
75.br
76a.out output file
77.sp
78.ti 0
79SEE ALSO as(I), ar(I)
80.sp
81.ti 0
82DIAGNOSTICS "file
83not found"-- bad argument
84.sp
85"bad format"-- bad argument
86.sp
87"relocation error"-- bad argument (relocation
88bits corrupted)
89.sp
90"multiply defined"-- same symbol defined twice in same load
91.sp
92"un"-- stands for "undefined symbol"
93
94"symbol not found"-- loader bug
95
96"can't move output file"-- can't move temporary to a.out file
97
98"no relocation bits"-- an input file lacks relocation information
99
100"too many symbols"-- too many references to external
101symbols in a given routine
102
103"premature EOF"
104
105"can't create l.out"-- cannot make temporary file
106
107"multiple entry point"-- more than one entry point
108specified (not possible yet).
109.sp
110.ti 0
111BUGS --