main.c

main()

{

a();

}

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.so $ cc main.o liba.so -o test2

Using the PA-32 linker, test2 executes without error. The module in liba.so created from lib2.o is determined to be unreachable during execution, so the global symbol for unsat (in lib2.o) is not bound.

The IPF and PA-64 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 IPF and PA-64 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:

$ cc -c main.c

$ cc -c +z a.c b.c

$ ld -b a.o -o libA.so $ ld -b b.o -o libB.so

$ cc main.o libA.so libB.so -o test3

The PA-32 linker toolset produces:

128 Creating and Using Libraries