[Bug target/21277] Runtime error with C++ shared library and --disable-shared

ebotcazou at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon May 2 09:54:00 GMT 2005


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-05-02 09:54 -------
> There's absolutely nothing illegal in static linking with a shared library
> other libraries that it uses. The intention is to make resulting shared 
> library loadable on every target machine with no regard to availablity of 
> shared libraries, and make the library as small as possible.

Indeed, except that if the static libraries are not compiled with -fPIC, your
shared library is only shared on disk, not in memory.

> The approach works fine for 32 bit on Solaris. And it is definetely a bug that
> it doesn't do so for 64 bit.

It works only by accident in 32-bit mode; it would fail if the R_SPARC_WDISP30
relocation was slightly different.  And, again, not using a shared libgcc on
Solaris means that exceptions cannot be propagated across shared libraries;
that's why g++ automatically passes -shared-libgcc on Solaris.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21277



More information about the Gcc-bugs mailing list