HP-UX 11i Version 2 Release Notes (October 2003)
Libraries and Programming
Link Editor (ld)
Chapter 9
229
Link Editor (ld)
The Link Editor, ld, takes one or more object files or libraries as input and combines
them to produce a single (usually executable) file.
Summary of Change
New functionality introduced to ld in HP-UX 11i v2 includes lazy loading of shared
libraries and direct binding support:
• Lazy loading of shared library (option: +[no]lazyload) – This option will enable
[disable] lazy loading of shared libraries.
For +lazyload libraries, loading is deferred until a reference is made to that library
during execution. Both the +lazyload and +nolazyload options may appear on the
link line at the same time. The mode that is specified, either explicitly or by default,
remains on for all subsequent libraries on the link line until the next occurrence of
one of these two options.
Libraries satisfying one or more of the following conditions are ineligible for lazy
loading:
— is a filter library
— is accessed via a data reference from another module
— is accessed via an indirect function call
The linker will silently convert such libraries into +nolazyload libraries.
Dependent libraries of +lazyload shared libraries will not be processed during link
time, unless they are explicitly specified on the link line.
Lazy loading can be disabled during runtime by setting the LD_NOLAZYLOAD
environment variable.
• Direct binding (option: -B [direct|lazydirect|nodirect]) – This option will
create a direct link between symbol references and shared libraries by recording the
name of the resolved shared library during symbol resolution. This information is
used during runtime to quickly resolve symbols without searching through all
currently loaded libraries.
-B direct will record direct binding for all shared libraries. Dependent shared
libraries will not be processed for -B direct link, unless they are explicitly specified
on the link line.
-B lazydirect will record direct binding information for libraries marked for lazy
loading.
-B nodirect will not record direct binding for any shared library; instead a “direct
hint” is recorded for references to libraries marked for lazy-loading.
• Interposer library (option: +interposer) – This option is only valid when building a
shared library. This will create a shared library that can be used for interposition.
When resolving references for an application with direct binding information, the
dynamic loader will search interposer libraries first. If the symbol cannot be resolved
on any interposing libraries, the direct binding information will be used.