libgcc_s dependency when linking with -shared

ejohanson epj@newpointtech.com
Fri Dec 8 18:08:00 GMT 2006


I gave the -static-libgcc option a try, and ldd no longer reports a
dependency on libgcc_s.so, but the the application instantly crashes on the
call to dlopen() to load the shared library.  So it seems like libgcc_s is
still in there-- it's just that now it's staticly linked as opposed to
dynamic.

Here is my very simple setup:

file f1.c:
void dummyfunc(void) {
    /* make a single function call into the 3rd-party library to force
linking against their ".a" lib */
}

file f2.c
main() {
    dlopen("f1.so",RTLD_NOW|RTLD_GLOBAL);
}

the above two files are compiled like this on solaris 8 x86 intel:
gcc -static-libgcc -shared -fPIC f1.c -o f1.so thirdparty.a
gcc -static-libgcc -o f2 f2.c -ldl

when i try to run f2, it segfaults on the call to dlopen which tries to open
f1.so.  the two files are literally as simple as the ones shown above (i am
not oversimplifying this example for the sake of the message board).

Thanks very much,
-Eric


-- 
View this message in context: http://www.nabble.com/libgcc_s-dependency-when-linking-with--shared-tf2781647.html#a7762393
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list