/usr/ccs/bin/ld
[options] objfilesCombine several objfiles, in the specified order, into a single executable object module (a.out by default). ld is the loader and is usually invoked automatically by compiler commands such as cc.
-a
Force default behavior for static linking (generate an object file and list undefined references). Do not use with -r
.
-b
Ignore special processing for shared reference symbols (dynamic linking only); output becomes more efficient but less sharable.
-B
directiveObey one of the following directives:
dynamic | When loading, use both dynamic (lib |
eliminate | Remove symbols not assigned a version definition. Solaris only. |
group | Treat a shared object and its dependencies as a group. Implies |
local | Treat any global symbols that are not assigned a version definition as local symbols. Solaris only. |
reduce | Perform the reduction of symbolic information specified by version definitions. Solaris only. |
static | When loading, use only static (lib |
symbolic | In dynamic linking, bind a symbol to its local definition, not to its global definition. |
-d
[c]Link dynamically (c is y
) or statically (c is n
); dynamic linking is the default.
-D
token,...Print debugging information as specified by token; use help
to get a list of possible values. Solaris only.
-e
symbolSet symbol as the address of the output file's entry point.
-f
objUse the symbol table of the shared object being built as an auxiliary filter on shared object obj. Do not use with -F
. Solaris only.
-F
objUse the symbol table of the shared object being built as a filter on shared object obj. Do not use with -f
. Solaris only.
-G
In dynamic linking, create a shared object and allow undefined symbols.
-h
nameUse name as the shared object file to search for during dynamic linking (default is Unix object file).
-i
Ignore LD_LIBRARY_PATH. Useful for avoiding unwanted effects on the runtime search of the executable being built. Solaris only.
-I
nameUse 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).
-l
xSearch a library named lib
x.so
or lib
x.a
(the placement of this option on the line affects when the library is searched).
-L
dirSearch directory dir before standard search directories (this option must precede -l
).
-m
List a memory profile for input/output sections.
-M
mapfileInvoke ld directives from mapfile (-M
messes up the output and is discouraged).
-N
stringAdd a DT_NEEDED
entry with the value string to the .dynamic
section of the object being built. Solaris only.
-o
fileSend the output to file (default is a.out).
-Q
cList version information about ld in the output (c = y
, the default) or do not list (c = n
).
-r
Allow output to be subject to another ld. (Retain relocation information.)
-R
pathRecord the colon-separated list of directories in path in the object file for use by the runtime loader. Multiple instances may be supplied; the values are concatenated together.
-s
Remove (strip) symbol table and relocation entries.
-t
Suppress warnings about multiply defined symbols of unequal size.
-u
symbolEnter symbol in symbol table; useful when loading from an archive library. symbol must precede the library that defines it (so -u
must precede -l
).
-V
Print the version of ld.
-YP,
dirlistSpecify 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.
-z
directiveSolaris only. Obey one of the following directives:
allextract | Extract all archive members. |
combreloc | Combine multiple relocation sections. |
defaultextract | Return to the default archive extraction rules. |
ignore | Ignore dynamic dependencies that are not referenced as part of the linking. |
initfirst | Shared objects only. This object's initialization runs before that of others added to the process at the same time. Similarly, its "finalization" runs after that of other objects. |
lazyload | Mark dynamic dependencies for lazy loading. Lazily loaded objects are loaded when the first binding to the object is made, not at process startup. |
loadfltr | Mark the filter object for immediate processing at runtime, instead of at the first binding. |
muldefs | Allow multiple symbol definitions, using the first one that occurs. Otherwise, multiple symbol definitions are a fatal error. |
nodefs | Allow undefined symbols. This is the default for shared objects. The behavior is undefined for executables. |
nodelete | Mark the object as not being deletable at runtime. |
nodlopen | Shared objects only. The object is not available from dlopen(3x). |
nolazyload | Don't mark dynamic dependencies for lazy loading. Lazily loaded objects are loaded when the first binding to the object is made, not at process startup. |
nopartial | Expand partially initialized symbols in input relocatable objects into the generated output file. |
noversion | Do not include any versioning sections. |
now | Force nonlazy runtime binding for the object. |
origin | The object requires immediate |
record | Record dynamic dependencies that are not referenced as part of the linking. This is the default. |
redlocsym | Remove all local symbols except for the |
textoff | In dynamic mode, allow relocations against all sections, including those that are not writable. This is the default for shared objects. |
textwarn | Dynamic mode only. Warn if there remain any relocations against nonwritable, allocatable sections. This is the default for executables. |
weakextract | Allow "weak" definitions to trigger archive extraction. |