HP-UX Reference (11i v2 07/12) - 1 User Commands A-M (vol 1)

l
ld_ia(1)
Integrity Systems Only
ld_ia(1)
You should include crt0.o in a
-noshared link.
For 32-bit mode: the dynamic loader is found at
/usr/lib/hpux32/dld.so
.
For 64-bit mode: the dynamic loader is found at
/usr/lib/hpux64/dld.so
.
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 searchs all the directories that it would search for a library that was specified with
-l (see
-L and LPATH).
Options
-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.
To create a statically-bound program, use the
-noshared option rather than -a
archive
.
-b Create a shared library rather than a normal executable file. Object files processed
with this option must contain position-independent code (PIC), generated by
default by the compiler.
See the discussion of position-independent code in cc(1), aCC(1), f90(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" symbols; that is, assign addresses and sizes, for
-r out-
put. This option also strips COMDAT information from the
-r output.
-dynamic This option is the default. Instructs the linker to produce a dynamically linked exe-
cutable (a program which can use shared libraries). This option is the complement of
-noshared.
If no shared libraries are linked in, the linker builds a dynamically linked executable.
However, in PA32-bit mode using the +compat option, if no shared libraries are
linked in, the linker builds a statically bound executable (or archive bound execut-
able).
For dynamically linked executables, the dynamic loader is involved in the process of
loading the executable, regardless of whether it was linked with shared libraries. For
-noshared (or statically bound) programs, control does not pass to the dynamic
loader. See dld.so(5) for more information.
-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.)
HP-UX 11i Version 2: December 2007 Update 2 Hewlett-Packard Company 499