GCC 3.2 fails to successfully create a shared library from archive library

Donatas Vyzas donatas@viesulas.ktu.lt
Tue Apr 4 18:06:00 GMT 2006


Hi!

I am using GCC 3.2 on HP-UX 11.0 (PARISC 1.1).
I am trying to compile openssl 0.9.8a as a shared library, and looks 
like gcc is not able to create a shared library from the successfully 
compiled archive library, while ld linker succeeds. All object files in 
archive are compiled with -fPIC flag, so this is possible.

the "gcc way" of  creating a shared library from archive library is:
$ gcc -fPIC -shared -Wl,-Fl,libcrypto.a -o libcrypto.sl
shared library libcrypto.sl *is* created, however, it does not contain 
any symbols from any object file in libcrypto.a (note the small size of 
libcrypto.sl):
$ ll libcrypto.*
-rw-r--r--   1 user    users      2622848 Apr  4 10:58 libcrypto.a
-rwxr-xr-x   1 user    users        12288 Apr  4 19:35 libcrypto.sl

If I do it using directly linker ld, everything is OK:
$ ld -b -Fl libcrypto.a -o libcrypto.sl
$ ll libcrypto.*
-rw-r--r--   1 user    users      2622848 Apr  4 10:58 libcrypto.a
-rwxr-xr-x   1 user    users      2535424 Apr  4 19:35 libcrypto.sl

I allways thought that GCC just uses external linker binary for linking, 
and passes the parameters to it, however I am starting to believe that 
it is not so simple in this case.

Can anyone explain why gcc fails to create a shared library? *Any* 
opinion is welcome.

Donatas Vyzas



More information about the Gcc-help mailing list