32v 1m ld

From Computer History Wiki
Revision as of 16:28, 26 October 2009 by Neozeed (talk | contribs) (New page: LD(1) UNIX Programmer's Manual LD(1) == NAME == ld - link editor == SYNOPSIS == ld [ option ] ... file ... == DESCRIPTION == _L_d combines ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

LD(1) UNIX Programmer's Manual LD(1)


    ld - link editor


    ld [ option ] ... file ...


    _L_d combines several object programs into one, resolves
    external references, and searches libraries.  In the sim-
    plest case several object _f_i_l_e_s are given, and _l_d combines
    them, producing an object module which can be either exe-
    cuted or become the input for a further _l_d run.  (In the
    latter case, the -r option must be given to preserve the
    relocation bits.)  The output of _l_d is left on a.out.  This
    file is made executable only if no errors occurred during
    the load.
    The argument routines are concatenated in the order speci-
    fied.  The entry point of the output is the beginning of the
    first routine (unless the -e option is specified).
    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.  If a routine from a library references another rou-
    tine in the library, the referenced routine must appear
    after the referencing routine in the library.  Thus the
    order of programs within libraries is important.
    The symbols `_etext', `_edata' and `_end' (`etext', `edata'
    and `end' in C) are reserved, and if referred to, are set to
    the first location above the program, the first location
    above initialized data, and the first location above all
    data respectively.  It is erroneous to define these symbols.
    _L_d understands several options.  Except for -l, they should
    appear before the file names.
    -D   Take the next argument as a hexadecimal number and pad
         the data segment with zero bytes to the indicated
    -d   Force definition of common storage even if the -r flag
         is present.
    -e   The following argument is taken to be the name of the
         entry point of the loaded program; location 0 is the
    -l_x  This option is an abbreviation for the library name
         `/lib/lib_x.a', where _x is a string.  If that does not
         exist, _l_d tries `/usr/lib/lib_x.a' A library is searched
         when its name is encountered, so the placement of a -l
         is significant.
    -N   Do not make the text portion read only or sharable.
         (Use "magic number" 0407.)
    -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.  This involves moving the
         data areas up to the first possible 512 byte boundary
         following the end of the text.  This option is the
         default under UNIX/32V; the only other choice is -N.
    -o   The _n_a_m_e argument after -o is used as the name of the
         _l_d output file, instead of a.out.
    -r   Generate relocation bits in the output file so that it
         can be the subject of another _l_d run.  This flag also
         prevents final definitions from being given to common
         symbols, and suppresses the `undefined symbol' diagnos-
    -S   `Strip' the output by removing all symbols except
         locals and globals.
    -s   `Strip' the output, that is, remove the symbol table
         and relocation bits to save space (but impair the use-
         fulness of the debugger).  This information can also be
         removed by _s_t_r_i_p(1).
    -T   The next argument is a hexadecimal number which sets
         the text segment origin.  The default origin is 0.
    -t   ("trace")  Print the name of each file as it is pro-
    -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 sym-
         bol table is empty and an unresolved reference is
         needed to force the loading of the first routine.
    -X   Save local symbols except for those whose names begin
         with `L'.  This option is used by _c_c(1) to discard
         internally-generated labels while retaining symbols
         local to routines.
    -x   Do not preserve local (non-.globl) symbols in the out-
         put symbol table; only enter external symbols.  This
         option saves some space in the output file.


    /lib/lib*.a      libraries
    /usr/lib/lib*.a  more libraries
    a.out            output file


    as(1), ar(1), cc(1)