Kenwood HP 9000 Personal Computer User Manual


 
Chapter 5 181
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
If these files are compiled and linked as:
cc -c main.c
cc -c +z lib1.c lib2.c
ld -b lib1.o lib2.o -o liba.sl
cc main.o liba.sl -o test2
Using the 32-bit mode linker, test2 executes without error. The module
in liba.sl created from lib2.o is determined to be unreachable
during execution, so the global symbol for unsat (in lib2.o) is not
bound.
The 64-bit mode linker toolset reports an unsatisfied symbol error for
unsat at link time or at run time if the program were made executable.
Promotion of Uninitialized Global Data Items
In the 64-bit mode linker toolset, the linker expands and promotes
uninitialized global data symbols in object files linked into a shared
library to global data objects, exactly like executable files. This is
standard with other SVR4 systems.
The result of this change is that load-time symbol resolution for one of
these objects stops at the first one encountered, instead of continuing
through all loaded libraries to see if an initialized data object exists.
For example, given these source files:
a.c
int object; /* Uninitialized global data symbol */
void a()
{
printf ("\tobject is %d\n", object);
}
b.c
int object =1; /* Initialized global data symbol */
void b()
{
}
main.c
main()
{
a();
}
If these files are compiled and linked as: