dld.so.5 (2012 03)
d
dld.so(5)
Itanium(R)-based Systems Only
dld.so(5)
NAME
dld.so - dynamic loader
MULTITHREAD USAGE
The dynamic loader is thread-safe.
DESCRIPTION
The
/usr/lib/hpux64/dld.so
shared library is the 64-bit dynamic loader. The
/usr/lib/hpux32/dld.so
shared library is the 32-bit dynamic loader. In programs that use shared
libraries,
dld.so is invoked automatically at startup time.
/usr/ccs/lib/hpux64/crt0.o
is the
64-bit run-time startup file.
/usr/ccs/lib/hpux32/crt0.o
is the 32-bit run-time startup file. The
/usr/lib/hpux32/uld.so
and /usr/lib/hpux64/uld.so
shared libraries are the 32-bit and
64-bit microloaders. In programs that use shared libraries, the microloader is invoked automatically at
startup time by exec(2). The microloader’s sole responsibility is to load the dynamic loader,
dld.so
, into
memory for program execution. The microloaders (
uld.so
) and the dynamic loaders (dld.so) are,
themselves, shared libraries, although they define no symbols for use by user programs.
Shared Libraries
Shared libraries are executable files created with the
-b option to ld (see ld(1)). They must contain
position-independent code (PIC) that can be mapped anywhere in the address space of a process and exe-
cuted with minimal relocation. PIC can use PC-relative addressing modes and/or linkage tables. The HP
compilers generate PIC by default.
Incomplete Executables
An executable program linked with one or more shared libraries is called an incomplete executable.
When creating an executable (
a.out) file from object files and libraries, the linker does not copy text
(code) or data from the shared library into the output file. Instead, the dynamic loader maps the library
into the address space of the process at run time. The linker binds all program references to shared
library routines and data to entries in a linkage table, and relies on the dynamic loader to fill in the link-
age table entries once the libraries have been mapped. This linkage table serves as a jump table for func-
tion calls.
Thread local storage
Two thread local storage models are supported: static and dynamic, which is controlled by a compiler
option
+tls=static/dynamic
. The default is +tls=dynamic. Shared libraries built with the
dynamic model can be loaded using dlopen (3C) and shl_load (3X) APIs. An attempt to load a shared
library built with the static model using dlopen (3C) or shl_load (3X) APIs will result in the following
error:
/usr/lib/hpux[32|64]/dld.so: Can’t shl_load() a library containing
Thread Local Storage: /usr/lib/hpux[32|64]/libcps.so.1
The dynamic loader tallies each shared library’s thread local storage size as well as the program’s thread
local storage size. When all libraries are loaded, the dynamic loader invokes an initializer in the system
library libc, which does the thread initialization, allocation of the initial thread, and sets the thread
pointer.
Loading
An incomplete executable contains a list of path names of the shared libraries searched at link time. At
run time, the dynamic loader attaches to the process all shared libraries that were linked with the pro-
gram. The dynamic loader attempts to load each library from the same directory in which it was found at
link time. It is possible to change the shared library run time search path by specifying a dynamic path
list. (For PA-RISC 32-bit compatibility mode information, see Dynamic Path List .)
The text segment of a library is shared among all processes that use it. The data and bss (uninitialized
data) segments are loaded on a page-by-page basis. When a process first accesses (reads or writes) a data
or bss page, a copy of that page is made for the process.
Dynamic Path List
For default mode libraries, the dynamic loader uses dynamic path searching to find shared libraries
whose names appear in a library list of the program or loaded shared libraries with no embedded
/ char-
acter. Dynamic path searching is enabled by default for these libraries or executables. If ld
+noenvvar is specified, the dynamic loader does not look at any dynamic path environment variables to
find dependent shared libraries. This limits the dynamic path searching to the value of rpath (run time
HP-UX 11i Version 3: March 2012 − 1 − Hewlett-Packard Company 1