Building libstdc++ non-shared with -fpic ?

Ingo Rohloff
Fri Jun 30 11:35:00 GMT 2000

> > Now if you try to build a shared library, which uses code of a 
> > static libstdc++, this will lead to problems, because the
> > static libstdc++ will contain code which is NOT position 
> > independent. 
> No, it won't lead to problems - at least not if these two library
> copies had the same source code, and where compiled by the same
> compiler release. You can certainly combine non-PIC code into a shared
> library, at least on Linux.

How is this possible ?
That would imply that you are able to build shared libraries, which
use code which is not position independent, so why would it be necessary
at all to use the -fPIC compiler switch to create a shared library ?

(Why should it be possible that some of the code has do be PIC and
 some of it doesn't need to be PIC ? 
 I think the all or nothing principle should apply:
 All PIC -> shared library possible
 Not all PIC -> shared library impossible

so long

More information about the Gcc mailing list