HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)
l
ld_pa(1)
PA-RISC Systems Only
ld_pa(1)
/usr/lib/pa20_64/dld.sl
and is invoked by exec for those programs that use shared libraries.
crt0.o is not required in shared bound links. The dynamic loader attaches each required library to the
process and resolves all symbolic references between the program and its libraries.
NOTE: For information on linking secure programs with shared libraries, see the Security Restrictions sec-
tion below.
The text segment of a shared library is shared among all processes that use the library; each process using
the library receives its own copy of the data segment. If
pxdb -s on has been run on the executable
that loads the library, the text segment of a shared library is mapped privately for each process running the
executable.
ld recursively examines the dependencies of shared libraries used by a program that was
created by ld.Ifld does not find a supporting shared library at the path recorded in the dependency list
of a shared library, and if the dependency is the result of an
-l argument used when the shared library
was created,
ld will search all the directories that it would search for a library that was specified with
-l
(see -L and LPATH).
Environment Variables
Arguments can be passed to the linker through the
LDOPTS environment variable as well as on the com-
mand line. The linker gets the value of
LDOPTS and places its contents before any arguments on the com-
mand line.
The LD_PXDB environment variable defines the full execution path for the debug preprocessor pxdb.
The default value is
/opt/langtools/bin/pxdb
. ld invokes pxdb on its output file if that file is
executable and contains debug information. To defer invocation of
pxdb until the first debug session, set
LD_PXDB to /bin/true .
The LPATH environment variable can be used to specify default directories to search for library files. See
the -l option.
Common Options
The common ld options are listed first, followed by the options supported only in a 32-bit linker, and then
the options only supported in a 64-bit linker.
-a search Specify whether shared or archive libraries are searched with the -l option. The
value of search should be one of archive, shared, archive_shared
,
shared_archive,ordefault
. This option can appear more than once, inter-
spersed among
-l options, to control the searching for each library. The default is to
use the shared version of a library if one is available, or the archive version if not.
If either archive or shared is active, only the specified library type is accepted.
If archive_shared is active, the archive form is preferred, but the shared form is
allowed.
If
shared_archive is active, the shared form is preferred but the archive form is
allowed.
-b Create a shared library rather than a normal executable file. Object files processed
with this option must contain position-independent code (PIC). See the discussion
of PIC in cc(1), CC(1) (part of the optional C++ compiler documentation), f77(1), pc(1),
as(1), and Linker and Libraries Online User Guide.
-c filename Read ld options from a file. Each line contains zero or more arguments separated by
white space. Each line in the file, including the last line, must end with a newline
character. A # character implies that the rest of the line is a comment. To escape a
# character, use the sequence ##.
-d Force definition of "common" storage; that is, assign addresses and sizes, for -r out-
put. This option also strips COMDAT information from the
-r output.
-dynamic This allows the linker to create a program which can use shared libraries. This is the
default for 64-bit links unless
+compat is used. In 32-bit mode, the linker creates a
static executable if there are no shared libraries on the link line.
-e epsym Set the default entry point address for the output file to be that of the symbol epsym.
(This option only applies to executable files.)
-h symbol Prior to writing the symbol table to the output file, mark this name as "local" so that it
is no longer externally visible. This ensures that this particular entry will not clash
HP-UX 11i Version 3: February 2007 − 2 − Hewlett-Packard Company 539