LD(1) UNIX Programmer's Manual LD(1) NAME ld - link editor SYNOPSIS ld [ -sulxrdnm ] [ -o name ] [ -h name ] [ -e name ] [ -R value ] [ -V num ] file ... HP-UX COMPATIBILITY Level: HP-UX/NUCLEUS Origin: HP and System III Remarks: This manual page describes the linker as imple- mented on the Series 200 computers. Refer to other _l_d(1) manual pages for information valid for other implementations. DESCRIPTION _L_d combines several object programs into one; resolves external references; and searches libraries (as created by _a_r(1)). In the simplest case several object _f_i_l_e_s are given, and _l_d combines them, producing an object module which can be either executed 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 if no errors occurred during the load and the -r flag was not specified. 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 used). 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, and the library has not been processed by _r_a_n_l_i_b(_1), the referenced routine must appear after the referencing routine in the library. Thus the order of pro- grams within libraries is important. If the first member of a library is named __.SYMDEF, then it is understood to be a dictionary for the library such as produced by _r_a_n_l_i_b; the dictionary is searched iteratively to satisfy as many refer- ences as possible. 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 ini- tialized data, and the first location above all data respec- tively. It is erroneous to define these symbols. _L_d understands several flag arguments which are written pre- ceded by a -. Except for -l, they should appear before the file names. -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 0x2000 is the default. -h For -r output, hide the named symbol by clearing the external bit in the symbol table. -l This option is an abbreviation for a library name. -l alone stands for /lib/libc.a, which is the standard system library for C and assembly language programs. -l_x stands for /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 place- ment of a -l is significant. -m The names of all files and archive members used to create the output file are written to the standard out- put. -n Arrange 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 512K word boundary fol- lowing the end of the text. -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'' diag- nostics. -R The next argument is a hexadecimal number which sets the text segment origin. The default value if 0x2000. -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). This option is turned off if there are any undefined symbols. -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. -V The _n_u_m argument is taken as a decimal version number identifying the a.out that is produced. _N_u_m must be in the range 0-32767. The version stamp is stored in the a.out header; see _a._o_u_t(5). -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. FILES /lib/lib?.a libraries /usr/lib/lib?.a more libraries a.out output file SEE ALSO ar(1), as(1), cc(1), a.out(5).