Installation guide
In this example, the −all option tells the linker to link all objects from the
old.a archive library. The −none option tells the linker to turn off the
−all option. The −no_archive option applies to the resolution of the −lc
option, but not to old.a, since it is explicitly mentioned.
8.1.6 Optimizing Application Startup when Using Shared Libraries
Your application starts more efficiently if your shared libraries can be
loaded at a preassigned starting address in virtual memory. To allow this
efficiency, the ld linker preassigns a starting address to each shared
library you create.
At application startup time, a shared library’s preassigned starting address
may already be in use. In this case, the system assigns a new starting
address to the library and the advantage of the preassigned starting
address is lost.
To make it more likely that a shared library can use its preassigned
starting address, you can cause the ld linker to assign a unique starting
address to each shared library you create.
If you create a shared library that only you will use, use the
−check_registry option in the ld command line. This option causes ld
to search the file you specify to determine what starting addresses are
assigned to shared libraries. The linker then assigns an unused starting
address to your shared library. The following example shows how to use the
−check_registry option:
% ld -shared -no_archive -check_registry \
/usr/shlib/so_locations \
libspecial_math.so special_math.o -lc
If the shared library you create will be used by other programmers on your
system, use the −update_registry option. This option causes the ld
linker to search the file you specify to determine what starting addresses
are assigned to shared libraries. The linker then assigns an unused
starting address to your shared library. The linker then adds to the file the
information that your shared library has been assigned that starting
address. Because that information is stored in the file, the linker can
determine that the address is already assigned when it assigns a starting
address to other shared libraries.
If no -check_registry or -update_registry option is specified when
building a shared library, the linker defaults to the -update_registry
option and the ./so_locations file.
8–6 Postmigration Programming Features