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

l
ld_pa(1) ld_pa(1)
(For PA-RISC Systems)
NAME
ld_pa: ld - link editor
SYNOPSIS
Common Options
ld [-bdmnqrstvxzEGIOPQVZ
][-a search ][
-c filename][-dynamic]
[
-e epsym][-h symbol]... [
-lx file]... [-l: library ]
[
-m][-noshared][-o
outfile][-u symbol]... [-y symbol]...
[
-B bind][-D offset][
-Fl lib][-L dir]... [-R offset][
-Pd]
[
-PD file][-PF file][
+afs func_sym_x=func_sym_y]...
[
+b path_list ][+compat][
+copyobjdebug][+df file][
+e symbol]
[
+ee symbol][+fb][
+fbu][+filter shared_library_path]
[
+fini function][+gst][
+gstsize size][+h internal_name][
+help][+init function ]
[
+interp file][+k][
+n][+[no]mergeseg
][+[no]mmap][+nocopyobjdebug
]
[
+noobjdebug][+objdebugonly
]
[
+origin shared_library_path][
+pd size][
+pgm name][+pi size][+s][+std][+tools
]
[
+v[no]shlibunsats
][+vallcompatwarnings
][+v[no]compatwarnings
][+FP flag]
[
+I symbol][+O[no]fastaccess
][+O[no]procelim
][+Oreusedir=dir]
[+Oselec-
tivepercent
n][+Oselectivesize
size][+OselectiveO3
][+Ostaticprediction
]
[
+profilebucketsize
size][+allowdups]
PA-RISC 32-Bit (SOM) Options
ld [-NST][-A name][-C n][-Fw][
-Fz][+cdp oldpath:newpath]
[
+cg pathname ][+dpv][+ea filename][+gstbuckets size][
+nosmartbind]
[
+plabel_cache flag]
PA-RISC 64-Bit (ELF) Options
ld [+allowrorelocs][
+[no]allowunsats][+[no]forceload][
+hideallsymbols][+ild]
[
+ildnowarn][+ildpad percentage ][+ildrelink][+interposer][-k filename]
[
+[no]lazyload][+linkersyms
][+nodefaultmap][+noenvvar][+nodynhash]
[
+nosectionmerge
][+paddata pagesize ][+padtext pagesize][+pdzero]
[
+stripunwind][+vtype type ]
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 or shared library or dependent shared library. It is com-
mon 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. The dynamic loader
/usr/lib/dld.sl on 32-bit links is invoked at startup time by the startup file crt0.o if a program
uses shared libraries. Identical copies of crt0.o can be found in either /usr/ccs/lib/crt0.o or
/opt/langtools/lib/crt0.o. For 64-bit mode, the dynamic loader is
/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.
The text segment of a shared library is shared among all processes that use the library; each process
HP-UX 11i Version 2: September 2004 1 Hewlett-Packard Company Section 1469