mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
193 lines
7.2 KiB
Groff
193 lines
7.2 KiB
Groff
.\"
|
|
.\" Copyright (c) 1993 Paul Kranenburg
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by Paul Kranenburg.
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
.\" derived from this software withough specific prior written permission
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
.\"
|
|
.\" $Id: ld.1,v 1.3 1993/11/02 22:56:51 pk Exp $
|
|
.\"
|
|
.Dd October 14, 1993
|
|
.Dt LD 8
|
|
.Os NetBSD 0.9
|
|
.Sh NAME
|
|
.Nm ld
|
|
.Nd link editor
|
|
.Sh SYNOPSIS
|
|
.Nm ld
|
|
.Op Fl MNnrSstXxz
|
|
.Bk -words
|
|
.Op Fl A Ar symbol-file
|
|
.Op Fl assert Ar keyword
|
|
.Op Fl B Ar linkmode
|
|
.Op Fl D Ar datasize
|
|
.Op Fl d Ar c
|
|
.Op Fl d Ar p
|
|
.Op Fl e Ar entry
|
|
.Op Fl l Ar library-specifier
|
|
.Op Fl L Ar library-search-path
|
|
.Op Fl o Ar filename
|
|
.Op Fl T Ar address
|
|
.Op Fl u Ar symbol
|
|
.Op Fl V Ar shlib-version
|
|
.Op Fl y Ar symbol
|
|
.Ek
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
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
|
|
.Nm ld.
|
|
Object files and archives are processed in the order given on the command line.
|
|
.Pp
|
|
The options are as follows:
|
|
.Pp
|
|
.Bl -tag -width indent
|
|
.It Fl A Ar symbol-file
|
|
The the symbol-file is taken as a base for link-editing the object files
|
|
on the command line.
|
|
.It \-assert Ar 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
|
|
.Nm ld\&.
|
|
.It Fl B Ar dynamic
|
|
Specifies that linking against dynamic libraries can take place. If a library
|
|
specifier of the form -lx appears on the command line,
|
|
.Nm ld
|
|
searches for a library of the from libx.so.n.m (see the
|
|
.Ar 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 complementary
|
|
to -Bstatic.
|
|
.It Fl B Ar static
|
|
The counterpart of -Bdynamic. This options turns off dynamic linking 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 error.
|
|
.It Fl B Ar shareable
|
|
Instructs the linker to build a shared object from the object files rather
|
|
than a normal executable image.
|
|
.It Fl B Ar symbolic
|
|
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
|
|
.Em base-relative
|
|
relocations, ie. translation with respect to the load address. Failure to
|
|
resolve any symbolic reference causes an error to be reported.
|
|
.It Fl B Ar forcearchive
|
|
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 without having to unpack
|
|
the archive.
|
|
.It Fl D Ar 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.
|
|
.It Fl d Ar c
|
|
Force allocation of commons even producing relocatable output.
|
|
.It Fl d Ar p
|
|
Force alias definitions of procedure calls in non-PIC code. Useful to
|
|
obtain shareable code in the presence of run-time relocations as such
|
|
calls will be re-directed through the Procedure Linkage Table (see
|
|
.Xr link 5)
|
|
.It Fl e Ar entry-symbol
|
|
Specifies the entry symbol for an executable.
|
|
.It Fl L Ar path
|
|
Add
|
|
.Ar path
|
|
to the list of directories to search for libraries specified with the
|
|
.Ar -l
|
|
option.
|
|
.It Fl l Ar lib-spec
|
|
This option specifies a library to be considered for inclusion in the
|
|
output. If the -Bdynamic option is in effect, a shared library of the
|
|
form lib<spec>.so.m.n (where
|
|
.Em m
|
|
is the major, and
|
|
.Em n
|
|
is the minor version number, respectively) is searched for first. The
|
|
library with the highest version found in the search path is selected.
|
|
If no shared library is found or the -Bstatic options is in effect,
|
|
an archive of the form lib<spec>.a is looked for in the library seach path.
|
|
.It Fl M
|
|
Produce output about the mapping of segments of the input files and the
|
|
values assigned to (global) symbols in the output file.
|
|
.It Fl N
|
|
Produce a OMAGIC output file.
|
|
.It Fl n
|
|
Produce a NMAGIC output file.
|
|
.It Fl o Ar filename
|
|
Specifies the name of the output file. Defaults to
|
|
.Dq a.out.
|
|
.It Fl r
|
|
Produce relocatable object file, suitable for another pass through
|
|
.Nm ld.
|
|
.It Fl S
|
|
Strip all debugger symbols from the output.
|
|
.It Fl s
|
|
Strip all symbols from the output.
|
|
.It Fl T
|
|
Specifies the start address of the text segment, with respect to which
|
|
all input files will be relocated.
|
|
.It Fl t
|
|
Leave a trace of the input files as they are processed.
|
|
.It Fl u Ar symbol
|
|
Force
|
|
.Ar symbol
|
|
to be marked as undefined. Useful to force loading of an archive member
|
|
in the absence of any other references to that member.
|
|
.It Fl V Ar version
|
|
Put the given version number into the output shared library (if one is
|
|
created). Useful to make shared libaries compatible with other operating
|
|
systems. Eg. SunOS 4.x libraries use version number 3. Defaults to 8.
|
|
.It Fl X
|
|
Discard local symbols in the input files that start with the letter
|
|
.Dq L
|
|
.It Fl x
|
|
Discard all local symbols in the input files.
|
|
.It Fl y symbol
|
|
Trace the manipulations inflicted on
|
|
.Ar symbol
|
|
.It Fl z
|
|
Make a ZMAGIC output file. This is the default.
|
|
.Sh FILES
|
|
.Sh SEE ALSO
|
|
.Xr ldconfig 1 ,
|
|
.Xr link 5
|
|
.Sh BUGS
|
|
Spurious
|
|
.Dq undefined symbols errors
|
|
may be reported for symbols originating in shared libraries. This occurs
|
|
when there is also at least one genuine undefined symbol to report.
|
|
.Sh 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
|
|
.Nm ld\&.
|
|
.Sh HISTORY
|
|
The shared library model employed by
|
|
.Nm ld
|
|
appeared first in SunOS 4.0
|