Chapter 3 91
Linker Tasks
Using 64-bit Mode Linker Options
• +b first means dld looks at the RPATH first when searching for
dependent shared libraries.
To get the default RPATH, you must specify ld +b. This instructs
the linker to construct a default RPATH consisting of the -L
directories and LPATH.
• +s first means the dynamic loader looks at the SHLIB_PATH
environment variable first when searching for dependent shared
libraries.
You must specify ld +s to force the dynamic loader to use
SHLIB_PATH to search for shared libraries at runtime.
At runtime, the dynamic loader does a 32-bit style load for all
compatibility mode dependent shared libraries. The dynamic loader:
• Does dynamic path searching for compatibility-mode dependent
shared libraries that have the dynamic path selected (set in the
DT_HP_NEEDED entry if the shared library was specified with -l).
• Uses SHLIB_PATH only if you specify ld +s (or chatr +s) for
compatibility-mode shared libraries.
• Allows RPATH inheritance from ancestors to children when searching
for dependent compatibility-mode shared libraries specified with ld
-l. This is only allowed in an a.out that was linked with +compat.
If the a.out was linked +std, no library (even a compatibility mode
shared library) uses embedded RPATH inheritance.
• Allows dynamic path searching on shared libraries loaded by
shl_load routines, if the DYNAMIC_FLAG is passed to shl_load().
• Does a depth-first search of all compatibility-mode dependent
libraries.
• Looks at RPATH or SHLIB_PATH first, depending on the ld +b/+s
ordering for all ld -l dependent shared libraries. The dynamic
loader looks at whichever has second precedence next, and then
looks for the shared library as specified in the dynamic load entry.
• Looks for the dynamic table entry as if the dynamic path bit is not
set.
Using the 64-bit Linker with +std for Standard Mode
The +std option instructs the linker to do a standard mode 64-bit style
link. This is currently the default in 64-bit mode.