Полезная информация

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: layersChapter 2
UNIX Commands
Next: Reference: ldd


ld [options] objfiles

Combine several objfiles, in the specified order, into a single executable object module (a.out by default). ld is the link editor and is often invoked automatically by compiler commands such as cc.



Force default behavior for static linking (generate an object file and list undefined references). Do not use with -r.


Ignore special processing for shared reference symbols (dynamic linking only); output becomes more efficient but less sharable.

-B mode

See description under cc.

-B symbolic

In dynamic linking, bind a symbol to its local definition, not to its global definition.


Force the definition of common storage.


Link dynamically (c is y) or statically (c in n); dynamic linking is the default.

-e symbol

Set symbol as the address of the output file's entry point.


In dynamic linking, create a shared object and allow undefined symbols.

-h name

Use name as the shared object file to search for during dynamic linking (default is UNIX object file).

-I name

Use name as the pathname of the loader (interpreter) to write into the program header. Default is none (static) or /usr/lib/libc.so.1 (dynamic).


Search a library named libx.so or libx.a (the placement of this option on the line affects when the library is searched).

-L dir

Search directory dir before standard search directories (this option must precede -l).


List a memory profile for input/output sections.

-M mapfile

Invoke ld directives from mapfile (-M messes up the output and is discouraged).


Put the data section immediately after the text section. (SVR3 only.)


Create output file as read-only.


Send the output to file (default is a.out).


List version information about ld in the output (c = y, the default) or do not list (c = n).


Allow output to be subject to another ld.


Remove symbol table and relocation entries.


Suppress warning about multiply-defined symbols of unequal size.

-u symbol

Enter symbol in symbol table; useful when loading from an archive library. symbol must precede the library that defines it (so -u must precede -l).


Print the version of ld.

-YP, dirlist

Specify a comma-separated list of directories to use in place of the default search directories (see also -L).

-z defs | nodefs | text

Specify nodefs to allow undefined symbols. The default, defs, treats undefined symbols as a fatal error. Use text to produce an error when there are nonwritable relocations.


Enter only external symbols in output.


Save all local symbols except those whose first letter is L.


Indicate each file in which sym appears, its type and whether the file defines or references it.


Arrange the file to be loaded on demand from the resulting executable file.

Previous: Reference: layersUNIX in a Nutshell: System V EditionNext: Reference: ldd
Reference: layersBook IndexReference: ldd

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System