views:

2

answers:

0

This is for AIX5.2, xlC compiler. Lets imagine we have two static libraries: A.a (contains funcA() function definition) B.a (contains funcB() and funcC() functions) Major thing is that funcB() in its body calls funcA() from A.a. But funcC() has independent code from A.a.

Needs to create a shared library, libX.so, which calls funcC() from B.a: xlC -G -o libX.so X.o -lB If only B.a is linked - I get unresolved symbol funcA in libX.so. If I specify to link both A.a and B.a - all symbols gets resolved and I can see that libX.so contains funcA, but libX.so actually need not it. I faced this issue on AIX5.2, using xlC compiler. At the same time, this case works fine on other platforms\compilers - libX.so links only B.a and contains only funcC().

So the question is why libX.so includes unnecessary symbols from A.a and how to tell to xlC to resolve only that symbols which explicitly needed by libX.so's objects? Thanks in advance.