HP-UX Reference (11i v1 00/12) - 5 Miscellaneous Topics, 7 Device (Special) Files, 9 General Information, Index (vol 9)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man5/!!!intro.5
________________________________________________________________
___ ___
d
dld.sl(5) dld.sl(5)
NAME
dld.sl - dynamic loader
MULTITHREAD USAGE
The dynamic loader is thread-safe.
DESCRIPTION
The /usr/lib/pa20_64/dld.sl program is the PA64 dynamic loader. The /usr/lib/dld.sl
program is the PA32 dynamic loader. In programs that use shared libraries, dld.sl is invoked automati-
cally at startup time by exec on PA64 and by the startup file crt0.o on PA32. Identical copies of
crt0.o are kept in both /opt/langtools/lib and /usr/ccs/lib directories. The dynamic
loader is, itself, a shared library, although it defines 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. It is gen-
erated by default by the compilers on PA64 and by specifying the
+z/+Z options on PA32. See the +help
option to ld(1) or the HP-UX Linker and Libraries User’s Guide manual for details on writing
PIC in assem-
bly language.
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 linkage table
entries once the libraries have been mapped. This linkage table serves as a jump table for function calls.
Thread local storage is now supported. The dynamic loader will tally each shared library’s thread local
storage size as well as the program’s thread local storage size. When all libraries are loaded, on PA32 the
dynamic loader will either call a thread routine to set the thread pointer and allocate space for the initial
thread or will call mmap() and lwp_setprivate()
to allocate the space and setup the thread
pointer. On PA64, the dynamic loader will invoke an initializer in the system library
libc which will do
the thread initialization, allocation of the initial thread, and set the thread pointer.
On previous PA32 releases, shared library data items referenced by the program were copied into the pro-
gram executable file so that the data references could be resolved statically. Beginning with the Series
700/800 10.0 release, references to shared library data from the
a.out are included in a linkage table and
are resolved at run time.
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 program.
The dynamic loader will attempt 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.
See PA32 Dynamic Path List and/or PA64 Dynamic Path List.
The text segment of a library is shared among all processes that use it. The data and bss segments are
shared 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.
PA32 Dynamic Path List
There are two was to specify a dynamic path list :
by storing a directory path list in the executable using the
+b path_list option to ld,
by linking the executable with ld option +s, enabling the executable to use the path list defined by
the SHLIB_PATH environment variable at run time.
The path list is a list of one or more path names separated by colons (:). The dynamic path list will work
only for libraries specified with the -l or -l: options to ld. However, it can be enabled for libraries
specified with a full path name using the
-l option to chatr (see chatr(1)). If both
+s and +b are
used, their relative order on the command line indicates which path list will be searched first in compatibil-
ity mode. See the
+help option to ld(1) or the HP-UX Linker and Libraries User’s Guide manual for more
HP-UX Release 11i: December 2000 1 Section 541
___
___