LD(1) LD(1)
NAME
ld, uld - MIPS link editor and ucode link editor
SYNOPSIS
ld [ option ] ... file ...
uld [ option ] ... file ...
DESCRIPTION
Ld, the MIPS link editor, runs on MIPS machines under the
UNIX system 4.3bsd and System V. It links MIPS extended
coff(5) object files. The archive format understood by ld
is the one created by the MIPS archiver ar(1).
The ld command combines several object files into one,
preforms relocation, resolves external symbols, and supports
symbol table information for symbolic debugging. In the
simplest case, the names of several object files are given.
Ld combines them, producing an object module that can be
executed or used as input for a subsequent ld run. The
output of ld is left in a.out. By default, this file is
executable if no errors occurred during the load.
The uld command combines several ucode object files and
libraries into one ucode object file. It ``hides'' external
symbols for better optimizations by subsequent compiler
passes. The symbol tables of coff(5) object files loaded
with ucode object files are used to determine what external
symbols not to ``hide'' along with files specified by the
user that contain lists of symbol names.
If any argument is a library, it is searched exactly once at
the point it is encountered in the argument list. Only
those routines defining an unresolved external reference are
loaded. The library (archive) symbol table (see ar(1)) is a
hash table and is searched to resolved external references
that can be satisfied by library members. The ordering of
library members is unimportant.
The following options are recognized by both ld and uld .
Those options used by one and not by one and not the other
are ignored. Any option can be preceded by a `k' (for
example -ko outfile) and except for -klx have the same
meaning with or without the preceding `k'. This is done so
that these options can be passed to both link editors
through compiler drivers.
When searching for libraries the default directories to
search in are /lib/, /usr/lib/ and /usr/local/lib/.
-o outfile
Produce an output object file by the name outfile. The
name of the default object file is a.out. In the event
Page 1 (last mod. 8/20/87)
LD(1) LD(1)
that outfile has undefined references at the end of the
link editor run, and the ``-r'' switch was not used,
outfile will be renamed a.out. a.out will contain
relocation information, as if the ``-r'' switch was
used.
-lx Search a library libx.a, where x is a string. A
library is searched when its name is encountered, so
the placement of a -l is significant.
-klx Search a library libx.b, where x is a string. These
libraries are intended to be ucode object libraries.
In all other ways, this option is like the -lx option.
Please note that this switch is non-standard, and may
not be supported across product lines.
-Ldir
Change the algorithm of searching for libx.a or libx.b
to look in dir before looking in the default
directories. This option is effective only if it
precedes the -l options on the command line.
-L Change the algorithm of searching for libx.a or libx.b
to never look in the default directories. This is
useful when the default directories for libraries
should not be searched and only the directories
specified by -Ldir are to be searched.
-Bstring
Append string to the library names created for the -lx
and -klx.
-p file
Preserve (don't ``hide'') the symbol names listed in
file when loading ucode object files. The symbol names
in the file are separated by blanks, tabs, or newlines.
Please note that this switch is non-standard, and may
not be supported across product lines.
-s Strip the symbolic information from the output object
file.
-x Do not preserve local (non-.globl) symbols in the
output symbol table; enter external and static symbols
only. This option saves some space in the output file.
-r Retain relocation entries in the output file.
Relocation entries must be saved if the output file is
to become an input file in a subsequent ld run. This
option also prevents final definitions from being given
to common symbols, and suppresses the `undefined
symbol' diagnostics.
Page 2 (last mod. 8/20/87)
LD(1) LD(1)
-d Force definition of common storage and define loader
defined symbols even if -r is present.
-u symname
Enter symname as an undefined in the symbol table.
This is useful for loading entirely from a library,
since initially the symbol table is empty and an
unresolved reference is needed to force the loading of
the first routine.
-z Arrange for the process to be loaded on demand from the
resulting executable file (413 format) rather than
preloaded, a ZMAGIC file. This is the default.
-n Arrange (by giving the output file a 0410 "magic
number") that when the output file is executed, the
text portion will be read-only and shared among all
users executing the file, an NMAGIC file. This
involves moving the data areas up to the first possible
pagesize byte boundary following the end of the text.
-N Place the data section immediately after the text and
do not make the text portion read only or sharable, an
OMAGIC file. (Use "magic number" 0407.)
-T num
Set the text segment origin. The argument num is a
hexadecimal number.
-D num
Set the data segment origin. The argument num is a
hexadecimal number. This option can be used only if
the final object is an OMAGIC file. Please note that
this switch is non-standard, and may not be supported
across product lines.
-B num
Set the bss segment origin. The argument num is a
hexadecimal number. This option can be used only if
the final object is an OMAGIC file. Please note that
this switch is non-standard, and may not be supported
across product lines.
-e epsym
Set the default entry point address for the output file
to be that of the symbol epsym.
-m Produce a map or listing of the input/output sections
on the standard output (UNIX system V-like map).
-M Produce a primitive load map, listing the names of the
files that will be loaded (UNIX 4.3bsd-like map).
Page 3 (last mod. 8/20/87)
LD(1) LD(1)
-v Set verbose mode. Print the name of each file as it is
processed.
-ysym
Indicate each file in which sym appears, sym's type and
whether the file defines or references sym. Many such
options may be given to trace many symbols.
-V Print a message giving information about the version of
ld being used.
-VS num
Use num as the decimal version stamp to identify the
a.out file that is produced. The version stamp is
stored in the optional and symbolic headers.
-f fill
Set the fill pattern for ``holes'' within an output
section. The argument fill is a four-byte hexadecimal
constant.
-G num
The argument num is taken to be a decimal number that
is the largest size in bytes of a .comm item that is to
be allocated in the small bss section for reference off
the global pointer. Please note that this switch is
non-standard, and may not be supported across product
lines.
-b Do not merge the symbolic information entries for the
same file into one entry for that file. This is only
needed when the symbolic information from the same file
appears differently in any of the objects to be linked.
This can occur when object files are compiled, by means
of conditional compilation, with an apparently
different version of an include file.
FILES
/lib/lib*.a
/usr/lib/lib*.a
/usr/local/lib/lib*.a libraries
a.out output file
SEE ALSO
cc(1), pc(1), f77(1), as(1), ar(1), coff(5)
ORIGIN
MIPS Computer Systems
Page 4 (last mod. 8/20/87)