Building libstdc++ non-shared with -fpic ?

Alexandre Oliva
Fri Jun 30 11:43:00 GMT 2000

On Jun 30, 2000, Ingo Rohloff <> wrote:

>> > 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 ?

It isn't always possible.  It depends on support from dynamic loaders,
to perform relocations on non-PIC code.  But then, since they will be
modifying code pages of the shared library, the pages will not be
shareable between multiple processes.

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  aoliva@{,}
CS PhD student at IC-Unicamp        oliva@{,}
Free Software Evangelist    *Please* write to mailing lists, not to me

More information about the Gcc mailing list