HP-UX Linker and Libraries User's Guide
candidates for removal. If the address of a procedure is taken, the subspace within which it resides
is not removed. If a subspace is referenced in any way by a fixup representing a reference other
than a PC-relative call or an absolute call it is not removed
Incomplete Executables
For incomplete executables, dead procedure elimination works in the same way as for complete
executables except that no exported symbols or their dependencies are removed. If an incomplete
executable contains a symbol that is to be referenced by a shared library and is not exported, it
is removed if the other conditions discussed above hold.
Shared Libraries
In shared libraries only symbols that are not referenced and not exported are removed. In shared
libraries all symbols that are not of local scope are exported. Therefore only locally scoped symbols
not referenced are removed.
Retain Unreferenced Symbols with +noprocelim_sym
The +Oprocelim option in linker enables optimization by removing all unreferenced procedure
symbols and data symbols. The +noprocelim_sym option enables you to retain certain
unreferenced symbols. For each symbol that you want to retain, you can use +Oprocelim in
combination with +noprocelim_sym.
For example,
ld +Oprocelim +noprocelim_sym xproc +noprocelim_sym xdata x.o -lc
This link command enables procedure elimination optimization while linking an executable, and
it identifies two symbols that should not be eliminated: xproc and xdata.
Relocatable Objects
When performing a relocatable link with the -r option, dead procedure elimination is disabled
since the only possible gain is the removal of unreferenced local procedures. Objects resulting
from a relocatable link are subject to dead procedure elimination upon a final link.
Affects on Symbolic Debugging
Any procedure that has symbolic debug information associated with it is not removed. Procedures
that do not have symbolic debug information associated with them but are included in a debug
link are removed if they are not referenced.
Profile-Based Optimization (PA-RISC)
In profile-based optimization (PBO), the compiler and linker work together to optimize an application
based on profile data obtained from running the application on a typical input data set. For
instance, if certain procedures call each other frequently, the linker can place them close together
in the a.out file, resulting in fewer instruction cache misses, TLB misses, and memory page faults
when the program runs. Similar optimizations can be done at the basic block levels of a procedure.
Profile data is also used by the compiler for other general tasks, such as code scheduling and
register allocation.
General Information about PBO
• “When to Use PBO” (page 205)
• “Restrictions and Limitations of PBO” (page 214)
• “Compatibility with 9.0 PBO” (page 216)
204 Improving Your Application Performance