-
- ld - invoke the link editor
-
- ld [ options ] [file ...]
-
- ld is a wrapper that invokes the underlying linker to create an executable or dynamic library. The ld
command combines several object files into one, performs relocation, resolves external symbols, builds tables and
relocation information for run-time linkage in case of dynamic libraries, and supports symbol table information for
symbolic debugging. This command can also be invoked as nld to create an executable or dynamic library that does
not depend on the UWIN runtime.
- Binding modes affect the linking of files that follow the specification. The binding mode is dynamic
initially.
- When building dynamically linked libraries with the -G option, a file with the .def or .ign
suffix can also be secified. The .def file is an export file used by the Visual C/C++ compiler. If the .ign
file is specified, then the .def will be generated from the extern symbols .o's and .a's on
the command line and will exclude any symbol in the .ign file using the program /usr/lib/mkdeffile.
- By default, the -g option produces code view debug information. The environment variable DEBUGTYPE
can be set to coff to produce symbol table information in coff format or to both to produce both coff
format and code view format.
-
- -e, --entry=entry
- Sets the entry point for the program or dynamically linked library.
- -g, --debug
- Produce additional symbol table information for debugging tools. When this option is
given, the -O option is suppressed.
- -m, --target=type
- Target specific control. type may be:
- 32
- Generate 32-bit binaries. The default may be 32 or 64 depending on the compilation
system installation.
- 64
- Generate 64-bit binaries. The default may be 32 or 64 depending on the compilation
system installation.
- -n, --show
- Do not execute the underlying linker. Also enables -V
- -o, --output=ofile
- Use the pathname ofile instead of the default a.out for
the executable file produced.
- -l library
- Link with object library library (for ld(1).)
This option must follow the sourcefile arguments. Library names are generated by first looking for library
.lib and then for liblibrary.a in each directory that it searches. If the -Bstatic
binding is in effect, the library.lib search is skipped.
- -r, --relocate
- Retain relocation entries in the output file so that the resulting output file can
be used as input in a subsequent ld command.
- -s
- Surpress the symbol table generation.
- -x
- Accepted but ignored.
- -u, --undef=name
- Make symbol name an unsatisfied external symbol so that it will be
searched for in a library.
- -A, --export-all
- Generate a -G .def file that exports all global symbols.
- -B, --bind=binding
- binding can be one of the following, optionally preceded by no[-]
to indicate the inverse:
- dynamic
- Subsequent objects will be dynamically linked. This is the default.
- static
- Subsequent objects will be statically linked.
- whole-archive
- All subsequent library members will be linked. The default -no-whole-archive
only links library members that resolve undefined symbols.
- -G, --dynamic
- Generate a dynamically linked library.
- -L, --libdir=dir
- Add dir to the list of directories containing object-library files.
- -O, --optimize
- Optimize the object code. Ignored when -g is used.
- -V, --verbose
- Show the command line(s) given to the underlying linker. When used by itself,
without operands, -V prints the pathname of the underlying linker directory.
- -v, --version
- Print the underlying compiler version string on the standard output and exit.
- -X, --specific
- Link for the compiler specific MSVCRNM.dll instead of the
generic /sys/MSVCRT.dll.
- -Y [pass,]argument
- Pass the given argument to the underlying linker. If pass
is specified it must be l.
- -Z
- Add a symbol table to the generated executable.
- --mt-administrator
- Run with administrator UAC.
- --mt-delete
- Delete --mt-input manifest after processing.
- --mt-embed
- Embed a manifest in the output executable if the underlying compilation system supports
manifests.
- --mt-architecture=type
- Manifest architecture type. The default value is *.
- --mt-description=description
- Manifest application description.
- --mt-language=type
- Manifest application language. The default value is neutral.
- --mt-name=company.product.application
- Manifest company.product.application.
- --mt-type=type
- Manifest application type. The default value is win32.
- --mt-version=version
- Manifest application version. Must be of the form n.n.n.n. The default
value is yyyy.mm.dd.0.
- --mt-input=file
- Use file instead of the default manifest.
- --mt-output=file
- Save the default manifest in file and do not add it to the output.
-
- 0
- All files linked successfully.
- >0
- One or more files did not link.
-
- cc(1), ar(1)
-
- version
- ld (AT&T Labs Research) 2009-01-20
- author
- David Korn <dgk@research.att.com>
- copyright
- Copyright © 1997-2010 AT&T Intellectual Property
- license
- http://www.opensource.org/licenses/cpl1.0.txt