Home
Search all pages
Subjects
By activity
Professions, Sciences, Humanities, Business, ...
User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...
Text Strings
Conversions, tests, processing, manipulation,...
Math
Integer, Floating point, Matrix, Statistics, Boolean, ...
Processing
Algorithms, Memory, Process control, Debugging, ...
Stored Data
Data storage, Integrity, Encryption, Compression, ...
Communications
Networks, protocols, Interprocess, Remote, Client Server, ...
Hard World Timing, Calendar and Clock, Audio, Video, Printer, Controls...
File System
Management, Filtering, File & Directory access, Viewers, ...
|
|
|
RocketLink!--> Man page versions:
LD(1) OpenBSD Reference Manual LD(1)
NAME
ld - link editor
SYNOPSIS
ld [-MNnprSstXxZz] [-A symbol-file] [-assert keyword] [-Blinkmode]
[-D data-size] [-d c] [-d p] [-e entry] [-llibrary-specifier]
[-Llibrary-search-path] [-Rrecord-library-search-path] [-nostdlib]
[-o filename] [-T address] [-u symbol] [-V shlib-version] [-y symbol]
DESCRIPTION
ld combines the object and archive files given on the command line into a
new object file. The output object file is either an executable program,
a shared object suitable for loading at run-time, or an object file that
can once again be processed by ld. Object files and archives are pro-
cessed in the order given on the command line.
The options are as follows:
-A symbol-file
The symbol-file is taken as a base for link-editing the object
files on the command line.
-assert keyword
This option has currently no effect. It is here for compatibility
with SunOS ld. All conditions which would cause a Sun assertion
to fail will currently always cause error or warning messages
from ld.
-Bdynamic
Specifies that linking against dynamic libraries can take place.
If a library specifier of the form -lspec appears on the command
line, ld searches for a library of the from lib<spec>.so.<n>.<m>
(see the -l option) according to the search rules in effect. If
such a file can not be found a traditional archive is looked for.
This options can appear anywhere on the command line and is com-
plementary to -Bstatic.
-Bstatic
The counterpart of -Bdynamic. This option turns off dynamic link-
ing for all library specifiers until a -Bdynamic is once again
given. Any explicitly mentioned shared object encountered on the
command line while this option is in effect is flagged as an er-
ror.
-Bshareable
Instructs the linker to build a shared object from the object
files rather than a normal executable image.
-Bsymbolic
This option causes all symbolic references in the output to be
resolved in this link-edit session. The only remaining run-time
relocation requirements are base-relative relocations, i.e.
translation with respect to the load address. Failure to resolve
any symbolic reference causes an error to be reported.
-Bforcearchive
Force all members of archives to be loaded, whether or not such
members contribute a definition to any plain object files. Useful
for making a shared library from an archive of PIC objects with-
out having to unpack the archive.
-Bsilly
Search for .sa silly archive companions of shared objects. Useful
for compatibility with version 3 shared objects.
-D data-size
Set the size of the data segment. For sanity's sake, this should
be larger than the cumulative data sizes of the input files.
-d c Force allocation of commons even producing relocatable output.
-d p Force alias definitions of procedure calls in non-PIC code. Use-
ful to obtain shareable code in the presence of run-time reloca-
tions as such calls will be re-directed through the Procedure
Linkage Table (see link(5).)
-e entry
Specifies the entry symbol for an executable.
-Lpath Add path to the list of directories to search for libraries spec-
ified with the -l option.
-lspec This option specifies a library to be considered for inclusion in
the output. If the -Bdynamic option is in effect, a shared li-
brary of the form lib<spec>.so.<m>.<n> is searched for first
(where m is the major, and n is the minor version number, respec-
tively.) The library with the highest version found in the
search path is selected. If no shared library is found or the
-Bstatic option is in effect, an archive of the form lib<spec>.a
is looked for in the library search path.
-M Produce output about the mapping of segments of the input files
and the values assigned to (global) symbols in the output file.
-N Produce an OMAGIC output file.
-n Produce a NMAGIC output file.
-nostdlib
Do not search the built-in path (usually ``/usr/lib'') for -l
specified libraries.
-o filename
Specifies the name of the output file. Defaults to ``a.out''.
-p Make the data segment start on a page boundary.
-Q Produce a QMAGIC output file.
-r Produce relocatable object file, suitable for another pass
through ld.
-Rpath Record path within the executable for run-time library search.
This only applies to dynamically linked executables.
-S Strip all debugger symbols from the output.
-s Strip all symbols from the output.
-T address
Specifies the start address of the text segment, with respect to
which all input files will be relocated.
-t Leave a trace of the input files as they are processed.
-u symbol
Force symbol to be marked as undefined. Useful to force loading
of an archive member in the absence of any other references to
that member.
-V version
Put the given version number into the output shared library (if
one is created). Useful to make shared libraries compatible with
other operating systems. E.g., SunOS 4.x libraries use version
number 3. Defaults to 8.
-X Discard local symbols in the input files that start with the let-
ter ``L''.
-x Discard all local symbols in the input files.
-y symbol
Trace the manipulations inflicted on symbol.
-z Make a ZMAGIC output file. This is the default.
-Z Make an old-style ZMAGIC output file. This means no flags and no
machine ID in the magic.
The following long options are exceptions to the normal option syntax de-
scribed above, and are provided for compatibility with later versions of
GNU ld:
-rpath path
Record the given path within the executable for run-time library
search, as for -R. This only applies to dynamically linked exe-
cutables.
-shared
Instructs the linker to build a shared object from the object
files rather than a normal executable image.
-soname library-name
This option and its library-name argument are ignored. They are
provided for compatibility with versions of ld, which allow the
user to specify an internal name and version number for dynami-
cally-linked shared libraries.
--whole-archive
A positional qualifier to force loading from archives. For each
archive mentioned on the commandline after this option, include
every object file from the archive in the link, rather than
searching the archive for the required object files. This is
normally used when building shared libraries.
The positional syntax is not currently implemented; --whole-
archive is treated exactly as -Bforcearchive.
--no-whole-archive
This option should turn off the effect of a preceding --whole-
archive for any subsequent archive files on the command line. It
is currently ignored.
ENVIRONMENT
ld utilizes the following environment variables:
LD_LIBRARY_PATH This colon-separated list of directories is inserted in-
to the search path for libraries following any directo-
ries specified via -L options and preceding the built-in
path.
LD_NOSTD_PATH When set, do not search the built-in path for libraries.
This is an alternative to the -nostdlib command-line
flag.
SEE ALSO
ldconfig(1), ld.so(1), link(5)
CAVEATS
An entry point must now explicitly be given if the output is intended to
be a normal executable program. This was not the case for the previous
version of ld.
BUGS
Shared objects are not properly checked for undefined symbols.
Cascading of shared object defeats the -Bstatic option.
All shared objects presented to ld are marked for run-time loading in the
output file, even if no symbols are needed from them.
HISTORY
The shared library model employed by ld appeared first in SunOS 4.0.
OpenBSD 2.6 October 14, 1993 4
Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts Institute of Technology, Free Software Foundation, FreeBSD Inc., and others. |
(Corrections, notes, and links courtesy of RocketAware.com)
GNU Sources for ld(1) (at FreeBSD cvsweb) FreeBSD Sources for ld(1) GNU sources for ld(1) (at OpenBSD cvsweb)
RocketLink!--> Man page versions:
Rapid-Links:
Search | About | Comments | Submit Path: RocketAware >
ld.1/
RocketAware.com is a service of Mib Software Copyright 1999, Forrest J. Cavalier III. All Rights Reserved. We welcome submissions and comments
|