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

l
ld_ia(1) ld_ia(1)
(For Itanium(R)-based Systems)
NAME
ld_ia: ld - link editor
SYNOPSIS
The link editor.
ld [-bdmnqrstvxzEGINOPQSTVZ
][
-a search][-c filename][-dynamic]
[
-e epsym][-h symbol]... [
-k filename][-lx file] ...
[
-l: library ][-m][
-noshared][-noshared_dynamic
][-o outfile]
[
-symbolic][-u symbol]... [
-y symbol]... [-A name]
[
-B bind]... [-C n][
-D offset][-Fl][-Fw][-Fz][-G
][-L dir]...
[
-N][-O][
-Pd][-PD file][-PF file][-Q][-R offset][
-S][-T][+[no]allowunsats
]
[
+as mode][+b path_list ][
+cdp oldpath:newpath][
+cg path][+compat]
[
+copyobjdebug
][+[no]defaultrpath
][+df file]
[
+dumpextern filename][+dpv][
+e symbol]... [+ee symbol]...
[
+fb][+fbu][+filter
shared_library_path]
[
+fini function ]... [+[no]forceload
]
[
+gstbuckets size][+gst][
+gstsize size][+h internal_name]
[
+help][+hideallsymbols
][+ild][+ildnowarn
][+ildpad percentage ]
[
+ildrelink][+init function ]... [
+instrumenter filename]
[
+interp filename][+k
][+mergeseg][+n][+nocopyobjdebug
]
[
+nodynhash][+nodefaultmap
][+noenvvar]
[
+noobjdebug][+nosectionmerge
][+nosmartbind][+nosrcpos]
[
+objdebugonly][+origin
shared_library_name][+paddata pagesize]
[
+padtext pagesize][+pd size][+pdzero][+pgm name][+pi
size]
[
+plabel_cache flag][
+profilebucketsize 16|32][+rpathfirst]
[
+s][+std][+stripunwind][+tools][+v[no]shlibunsats
]
[
+vallcompatwarnings
][+v[no]compatwarnings]
[
+vtype type][+FP flag][+I symbol]... [+O[no]fastaccess
]
[
+O[no]procelim][
+Oreusedir=dir ][+Oselectivepercent n]
[
+Oselectivesize
size][+OselectiveO3][+Ostaticprediction
]
[
+allowdups][+interposer][+[no]lazyload
]
DESCRIPTION
ld takes one or more object files or libraries as input and combines them to produce a single (usually exe-
cutable) file. In doing so it resolves references to external symbols, assigns final addresses to procedures
and variables, revises code and data to reflect new addresses (a process called "relocation") and updates
symbolic debug information when present in the file. By default, ld produces an executable file that can
be run by the HP-UX loader exec() (see exec(2)). Alternatively, the linker can generate a relocatable
file that is suitable for further processing by ld (see -r below). It can also generate a shared library
(see -b below). The linker marks the output file non-executable if there are any duplicate symbols or
any unresolved external references remain. ld may or may not generate an output file (see
+k option)
if any other errors occur during its operation.
ld recognizes three kinds of input files: object files created by the compilers, assembler, or linker (also
known as .o files), shared libraries created by the linker, and archives of object files (called archive
libraries). An archive library contains a table of all the externally-visible symbols from its component
object files. (The archiver command ar(1) creates and maintains this index.) ld uses this table to
resolve references to external symbols.
ld processes files in the same order as they appear on the command line. It includes code and data from
an archive library element if and only if that object module provides a definition for a currently
unresolved reference within the user’s program (see +[no]forceload). It is common practice to list
libraries following the names of all simple object files on the command line.
Code and data from shared libraries is never copied into an executable program. For 32-bit mode,
crt0.o is found at /usr/ccs/lib/hpux32/crt0.o. For 64-bit mode, crt0.o is found at
/usr/ccs/lib/hpux64/crt0.o. 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.
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 execut-
able that loads the library, the text segment of a shared library is mapped privately for each process
Section 1−−450 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: September 2004