man(1) Manual page archive

ld(1) - Unix First Edition Manual Page
11/3/71LD (I)

NAME ld -- link editor
SYNOPSIS ld [ --usaol ] name1 ]
DESCRIPTION ld combines several object programs into one; resolvesexternal references; and searches libraries. In the


simplest case the names of several object programs aregiven, and ld combines them, producing an object module which can be either executed or become the input for afurther ld run.


The argument routines are concatenated in the orderspecified. The entry point of the output is the beginning of the first routine. If any argument is a library, it is searched, and onlythose routines defining an unresolved external reference are loaded. If any routine loaded from a library refers toan undefined symbol which does not become defined by the end of the library, the library is searched again. Thus theorder of libraries primarily affects the efficiency of loading, not what routines get loaded.


ld understands several flag arguments which are writtenpreceded by a "--"


--s "squash" the output, that is, remove the symboltable and relocation bits to save space (but impair


the usefulness of the debugger). This informationcan also be removed by strip.


--u take the following argument as a symbol and enter itas undefined in the symbol table. This is useful for


loading wholly from a library, since initially thesymbol table is empty and an unresolved reference is needed to force the loading of the first routine. --o set the origin of the load to the octal number whichis given as the next argument. This option affects


only the definition of relocatable external symbols.See DMR before using.


--l This option is an abbreviation for a libraryname. "-l" alone stands for "/etc/liba.a", which is the standard system library for assembly languageprograms. "-lx" stands for /etc/libx.a where x is any character. There are libraries for Fortran(x="f") and B (x="b").


11/3/71LD (I)



--a means absolute" (load at origin absolute0) but it doesn't work. The output of ld is left on a.out. This file is executableonly if no errors occurred during the load.
FILES /etc/libx.a, for various x;/etc/ltma, ltmb, ... (temporary)


a.out (output file)
SEE_ALSO as, strip, ar (maintains libraries)
DIAGNOSTICS "can't create temp file"---- unwritable directoryor someone else is using ld in the same directory.


"can't open temp file" -- maybe someone has deleted it outfrom under you.


"file not found" -- bad argument "bad format" -- bad argument "relocation error" -- bad argument (relocation bitscorrupted)


"bad relocation" -- user error: a relocatablereference to an external symbol that turns out to be absolute.


"multiply defined" -- same symbol defined twice in sameload


"un" -- stands for undefined symbol "symbol not found" ---- loader bug
BUGS Option "-a" doesn't work at all; option "-o" doesn't workright.


OWNER dmr