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)
Archive or shared libraries are added/removed to/from the linker command line.
Objects are added/removed to/from the linker command line.
See the Online Linker and Libraries User’s Guide (
ld +help) for more information.
Archive Library Processing
The incremental linker searches an archive library if there are unsatisfied symbols. It extracts all archive
members satisfying unsats and processes them as new object files. If an archive library is modified, the
linker replaces the modified archive library.
An object file extracted from an archive library in the previous link remains in the output load module
even if all references to symbols defined in the object file have been removed. The linker removes these
object files when it performs the next initial incremental link.
Shared Library Processing
In an initial incremental link, the linker scans shared library symbol tables and resolves unsats the same
way it would in a regular link. In incremental links, the linker does not process shared libraries and their
symbol tables at all and does not report shared library unsats. The dynamic loader detects them at run
time. If any of the shared libraries on the command line was modified, the linker reverts to an initial
incremental link.
Performance
Performance of the incremental linker may suffer greatly if you change a high percentage of object files.
The incremental linker may not link small programs much faster, and the relative increase in size of the
executable is greater than that for larger programs.
Generally, the linker needs to scan through all shared libraries on a link line in order to determine all
the unsats, even in incremental links. This process may slow down incremental links. The incremental
linker does not scan shared libraries and leaves detection of shared library unsats to the dynamic loader.
Do not use the incremental linker to create final production modules. Because it reserves additional pad-
ding space, modules created by the incremental linker are considerably larger than those created in regu-
lar links.
Notes
The HP WDB symbolic debugger only supports debugging of incrementally linked load modules that you
create with the +objdebug compiler option enabled. (The HP DDE debugger does not support the
+ild option.
Any program that modifies an executable (for example,
strip(1)), may affect the ability of
ld to perform
an incremental link. When this happens, the incremental linker issues a message and performs an initial
incremental link.
Third-party tools that work on object files may have unexpected results on modules produced by the
incremental linker.
Kernel Virtual Environment Support
For virtual environment support for the kernel, build your kernel with the following linker options
(instead of the
-noshared option):
$
ld ... -Bsymbolic -b +hideallsymbols +allowrorelocs +linkersyms
...
By using these options, you create the kernel as a self-contained shared library with no exported symbols
(with the
-Bsymbolic, -b, and +hideallsymbols options). Because the kernel contains references
to linker-generated symbols such as _etext, _end, and _edata, the +linkersyms option instructs
the linker to create these symbols (which it does not do for shared libraries by default). The kernel con-
tains direct calls and relocations in read-only data space. Normally these are applied at link time and are
fixed up to link-time virtual addresses. In the case of relocatable kernels, the linker needs to create
dynamic relocations to fix up these references at run-time. The +allowrorelocs option instructs the
linker to allow dynamic relocations in read-only sections (Normally the linker issues an error message).
EXTERNAL INFLUENCES
Environment Variables
The following environment variables affect the execution of
ld:
Section 1484 Hewlett-Packard Company 16 HP-UX 11i Version 2: September 2004