Skip Navigation Links | |
Exit Print View | |
Linker and Libraries Guide Oracle Solaris 11 Information Library |
Part I Using the Link-Editor and Runtime Linker
1. Introduction to the Oracle Solaris Link Editors
Recording a Shared Object Name
Inclusion of Shared Objects in Archives
Shared Objects With Dependencies
Lazy Loading of Dynamic Dependencies
SPARC: -K pic and -K PIC Options
Collapse Multiply-Defined Data
When Relocations are Performed
6. Establishing Dependencies with Dynamic String Tokens
7. Link-Editor Quick Reference
Part IV ELF Application Binary Interface
13. Program Loading and Dynamic Linking
A. Linker and Libraries Updates and New Features
When dynamic executables and shared objects have dependencies on the same common shared objects, the order in which the objects are processed can become less predictable.
For example, assume a shared object developer generates libfoo.so.1 with the following dependencies.
$ ldd libfoo.so.1 libA.so.1 => ./libA.so.1 libB.so.1 => ./libB.so.1 libC.so.1 => ./libC.so.1
If you create a dynamic executable prog, using this shared object, and define an explicit dependency on libC.so.1, the resulting shared object order will be as follows.
$ cc -o prog main.c -R. -L. -lC -lfoo $ ldd prog libC.so.1 => ./libC.so.1 libfoo.so.1 => ./libfoo.so.1 libA.so.1 => ./libA.so.1 libB.so.1 => ./libB.so.1
Any requirement on the order of processing the shared object libfoo.so.1 dependencies would be compromised by the construction of the dynamic executable prog.
Developers who place special emphasis on symbol interposition and .init section processing should be aware of this potential change in shared object processing order.