Annotation of cci/usr/src/man/man1/ld.1, revision 1.1

1.1     ! root        1: .TH LD 1 "18 January 1983"
        !             2: .UC 4
        !             3: .SH NAME
        !             4: ld \- link editor
        !             5: .SH SYNOPSIS
        !             6: .B ld
        !             7: [ option ] ... file ...
        !             8: .SH DESCRIPTION
        !             9: .I Ld
        !            10: combines several
        !            11: object programs into one, resolves external
        !            12: references, and searches libraries.
        !            13: In the simplest case several object
        !            14: .I files
        !            15: are given, and
        !            16: .I ld
        !            17: combines them, producing
        !            18: an object module which can be either executed or
        !            19: become the input for a further
        !            20: .I ld
        !            21: run.
        !            22: (In the latter case, the
        !            23: .B \-r
        !            24: option must be given
        !            25: to preserve the relocation bits.)\ 
        !            26: The output of
        !            27: .I ld
        !            28: is left on
        !            29: .BR a.out .
        !            30: This file is made executable
        !            31: only if no errors occurred during the load.
        !            32: .PP
        !            33: The argument routines are concatenated in the order
        !            34: specified.  The entry point of the output is the
        !            35: beginning of the first routine (unless the \fB\-e\fP option is specified).
        !            36: .PP
        !            37: If any argument is a library, it is searched exactly once
        !            38: at the point it is encountered in the argument list.
        !            39: Only those routines defining an unresolved external
        !            40: reference are loaded.
        !            41: If a routine from a library
        !            42: references another routine in the library,
        !            43: and the library has not been processed by
        !            44: .IR ranlib (1),
        !            45: the referenced routine must appear after the
        !            46: referencing routine in the library.
        !            47: Thus the order of programs within libraries
        !            48: may be important.
        !            49: The first member of a library
        !            50: should be a file named `\_\^\_.SYMDEF',
        !            51: which is understood to be a dictionary for the library as produced by
        !            52: .IR ranlib (1);
        !            53: the dictionary is searched iteratively to satisfy as many references as
        !            54: possible.
        !            55: .PP
        !            56: The symbols `\_etext', `\_edata' and `\_end'
        !            57: (`etext', `edata' and `end' in C)
        !            58: are reserved, and if referred to,
        !            59: are set to the first location above the program,
        !            60: the first location above initialized data,
        !            61: and the first location above all data respectively.
        !            62: It is erroneous to define these symbols.
        !            63: .PP
        !            64: .I Ld
        !            65: understands several options.
        !            66: Except for
        !            67: .BR \-l ,
        !            68: they should appear before the file names.
        !            69: .TP
        !            70: .B \-A
        !            71: This option specifies incremental loading, i.e.
        !            72: linking is to be done in a manner so that the resulting object
        !            73: may be read into an already executing program.
        !            74: The next argument is the name of a file whose symbol table will be
        !            75: taken as a basis on which to define additional symbols.
        !            76: Only newly linked material will be entered into the text and
        !            77: data portions of 
        !            78: .BR a.out,
        !            79: but the new symbol table will reflect
        !            80: every symbol defined before and after the incremental load.
        !            81: This argument must appear before any other object file in the argument list.
        !            82: The
        !            83: .B \-T
        !            84: option may be used as well, and will be taken to mean that the
        !            85: newly linked segment will commence at the corresponding address
        !            86: (which must be a multiple of 1024).
        !            87: The default value is the old value of _end.
        !            88: .TP
        !            89: .B \-D
        !            90: Take the next argument as a hexadecimal number and pad the data segment
        !            91: with zero bytes to the indicated length.
        !            92: .TP 
        !            93: .B  \-d
        !            94: Force definition of common storage
        !            95: even if the
        !            96: .B \-r
        !            97: flag is present.
        !            98: .TP
        !            99: .B \-e
        !           100: The following argument is taken to be the
        !           101: name of the entry point of the loaded
        !           102: program; location 0 is the default.
        !           103: .TP 
        !           104: .BI \-l x
        !           105: This
        !           106: option is an abbreviation for the library name
        !           107: .RI `/lib/lib x .a',
        !           108: where
        !           109: .I x
        !           110: is a string.
        !           111: If that does not exist,
        !           112: .I ld
        !           113: tries
        !           114: .RI `/usr/lib/lib x .a'
        !           115: A library is searched when its name is encountered,
        !           116: so the placement of a
        !           117: .B  \-l
        !           118: is significant.
        !           119: .TP
        !           120: .B \-M
        !           121: produce a primitive load map, listing the names of the files
        !           122: which will be loaded.
        !           123: .TP
        !           124: .B \-N
        !           125: Do not make the text portion read only or sharable.  (Use "magic number" 0407.)
        !           126: .TP 
        !           127: .B  \-n
        !           128: Arrange (by giving the output file a 0410 "magic number") that
        !           129: when the output file is executed,
        !           130: the text portion will be read-only and shared
        !           131: among all users executing the file.
        !           132: This involves moving the data areas up to the first
        !           133: possible 1024 byte boundary following the
        !           134: end of the text.
        !           135: .TP 
        !           136: .B  \-o
        !           137: The
        !           138: .I name
        !           139: argument after
        !           140: .B \-o
        !           141: is used as the name of the
        !           142: .I ld
        !           143: output file, instead of
        !           144: .BR a.out .
        !           145: .TP 
        !           146: .B  \-r
        !           147: Generate relocation bits in the output file
        !           148: so that it can be the subject of another
        !           149: .I ld
        !           150: run.
        !           151: This flag also prevents final definitions from being
        !           152: given to common symbols,
        !           153: and suppresses the `undefined symbol' diagnostics.
        !           154: .TP
        !           155: .B \-S
        !           156: `Strip' the output by removing all symbols except locals and globals.
        !           157: .TP 
        !           158: .B  \-s
        !           159: `Strip' the output, that is, remove the symbol table
        !           160: and relocation bits to save space (but impair the
        !           161: usefulness of the debuggers).
        !           162: This information can also be removed by
        !           163: .IR  strip (1).
        !           164: .TP
        !           165: .B \-T
        !           166: The next argument is a hexadecimal number which sets the text segment origin.
        !           167: The default origin is 0.
        !           168: .TP
        !           169: .B \-B
        !           170: The next argument is a hexadecimal number which sets the base of the data
        !           171: (data origin).  The default origin is the first multiple of 1024 after the
        !           172: text.
        !           173: .TP
        !           174: .B \-t
        !           175: ("trace")  Print the name of each file as it is processed.
        !           176: .TP 
        !           177: .B  \-u
        !           178: Take the following argument as a symbol and enter
        !           179: it as undefined in the symbol table.  This is useful
        !           180: for loading wholly from a library, since initially the symbol
        !           181: table is empty and an unresolved reference is needed
        !           182: to force the loading of the first routine.
        !           183: .TP 
        !           184: .B  \-X
        !           185: Save local symbols
        !           186: except for those whose names begin with `L'.
        !           187: This option is used by
        !           188: .IR cc (1)
        !           189: to discard internally-generated labels while
        !           190: retaining symbols local to routines.
        !           191: .TP 
        !           192: .B  \-x
        !           193: Do not preserve local
        !           194: (non-.globl) symbols in the output symbol table; only enter
        !           195: external symbols.
        !           196: This option saves some space in the output file.
        !           197: .TP
        !           198: \fB\-y\fIsym\fR
        !           199: Indicate each file in which
        !           200: .I sym
        !           201: appears, its type and whether the file defines or references it.
        !           202: Many such options may be given to trace many symbols.
        !           203: (It is usually necessary to begin
        !           204: .I sym
        !           205: with an `_', as external C, FORTRAN and Pascal variables begin
        !           206: with underscores.)
        !           207: .TP
        !           208: .B \-z
        !           209: Arrange for the process to be loaded on
        !           210: demand from the resulting executable file (413 format)
        !           211: rather than preloaded.
        !           212: This is the default.
        !           213: Results in a 1024 byte header on the output file followed by
        !           214: a text and data segment each of which have size a multiple of 1024 bytes
        !           215: (being padded out with nulls in the file if necessary).
        !           216: With this format the first few BSS segment symbols may actually appear
        !           217: (from the output of
        !           218: .IR size (1))
        !           219: to live in the data segment;
        !           220: this to avoid wasting the space resulting from data segment size roundup.
        !           221: .SH FILES
        !           222: .ta \w'/usr/local/lib/lib*.a\ \ 'u
        !           223: /lib/lib*.a    libraries
        !           224: .br
        !           225: /usr/lib/lib*.a        more libraries
        !           226: .br
        !           227: /usr/local/lib/lib*.a  still more libraries
        !           228: .br
        !           229: a.out  output file
        !           230: .SH "SEE ALSO"
        !           231: as(1), ar(1), cc(1), ranlib(1)
        !           232: .SH BUGS
        !           233: There is no way to force data to be page aligned.
        !           234: .I Ld
        !           235: pads images which are to be demand loaded from
        !           236: the file system to the next
        !           237: page boundary to avoid a bug in the system.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.