HP-UX 11i Version 1.6 Release Notes
Programming
Linker and Dynamic Loader TLS Support
Chapter 7
104
Linker and Dynamic Loader TLS Support
Linker (ld) takes one or more object files or libraries as input and combines them to
produce a single file.
The dynamic loader (dld) attaches each required library to the process and resolves all
the symbolic references between the program and its libraries. Is
Summary of Change
Both linker and dynamic loader now have support to create and dynamically load [using
dlopen() and shl_load() APIs] shared libraries containing thread local storage (TLS).
Details of Change
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() and shl_load()
APIs. An attempt to load a shared library built with the static model using dlopen() or
shl_load() APIs results 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]/libpthread.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.
Impact
There are no changes to the linker options/usage patterns with respect to building
executables and shared libraries. As long as +tls=dynamic compiler option is used to
create object files containing TLS, the linker creates load modules with the dynamic TLS
model which in all cases is transparent. There are no changes to the options provided by
the APIs dlopen(), shl_load(), to
dld.so
flags , and run time options. The dynamic
loader operation, with respect to dynamic TLS support, is transparent.
Compatibility
Applications built on systems prior to HP-UX 11i v1.6 and moved forward to run on
HP-UX 11i v1.6 systems are compatible.
Performance
Due to longer access sequences for TLS variables and more complex internal data
structures, we expect a slight degradation in performance (within 10%) for applications
that heavily use thread local storage.