HP-UX Reference (11i v2 07/12) - 1 User Commands A-M (vol 1)

l
ld_pa(1)
PA-RISC Systems Only
ld_pa(1)
Incremental linking with ld (64-bit Mode ONLY)
In the edit-compile-link-debug development cycle, link time is a significant component. The incremental
linker (available through the +ild and +ildrelink options) can reduce the link time by taking advan-
tage of the fact that you can reuse most of the previous version of the program and that the unchanged
object files do not need to be processed.
The incremental linker allows you to insert object code into an output file (executable or shared library)
that you created earlier, without relinking the unmodified object files. The time required to relink after the
initial incremental link depends on the number of modules you modify.
The linker performs the following different modes of linking:
normal link: the default operation mode in which the linker links all modules.
initial incremental link: the mode entered when you request an incremental link, but the output
module created by the incremental linker does not exist, or it exists but the incremental linker is unable
to perform an incremental update.
incremental link: the mode entered when you request an incremental link, an output module created by
the incremental linker exists, and the incremental linker does not require an initial incremental link.
Incremental links are usually much faster than regular links. On the initial link, the incremental linker
requires about the same amount of time that a normal link process requires, but subsequent incremental
links can be much faster than a normal link. A change in one object file in a moderate size link (tens of
files, several megabytes total) normally is about 10 times faster than a regular
ld link. The incremental
linker perform as many incremental links as allocated padding space and other constrains permit. The cost
of the reduced link time is an increase in the size of the executable or shared library.
The incremental linker allocates padding space for all components of the output file. Padding makes
modules larger than those modules linked by
ld. As object files increase in size during successive incre-
mental links, the incremental linker can exhaust the available padding. If this occurs, it displays a warning
message and does a complete initial incremental link of the module.
When an object file changes, the incremental linker not only replaces the content of that file in the execut-
able or shared library being linked, but also adjusts references to all symbols defined in the object file and
referenced by other objects. This is done by looking at relocation records saved in the incrementally linked
executable or shared library.
On the initial incremental link, the linker processes the input object files and libraries in the same way as
the normal link. In addition to the normal linking process, the incremental linker saves information about
object files, global symbols, and relocations, and pads sections in the output file for expansion. On subse-
quent incremental links, the linker uses timestamps and file sizes to determine which object files have
changed, and updates those modules.
Under certain conditions, the incremental linker cannot perform incremental links. When this occurs, the
incremental linker automatically performs an initial incremental link to restore the process. In the follow-
ing situations, the linker automatically performs an initial incremental link of the output file:
Changed linker command line, where the linker command line does not match the command line stored
in the output file. (With the exceptions of the verbose and tracing options)
Any of the padding spaces have been exhausted.
Modules have been modified by the ld -s or ld -x options or tools (for example, strip(1)). The incre-
mental linking requires the parts of the output load module which are stripped out with these options.
Incompatible incremental linker version, when you run a new version of the incremental linker on an
executable created by an older version.
New working directory, where the incremental linker performs an initial incremental link if current
directory changes.
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.
HP-UX 11i Version 2: December 2007 Update 17 Hewlett-Packard Company 535