Building libstdc++ non-shared with -fpic ?

Alexandre Oliva
Fri Jun 30 08:36:00 GMT 2000

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

> A resolution to this problem seems to compile libstdc++ as
> static library BUT with the -fpic option, so that the code
> included in the static archive is PIC.

PIC code may be far slower than non-PIC code, due to increased
register pressure, so doing that by default is not a good idea.  But
there might be an option to do it.

> PS: Some people said that the linker should be able to recognize
>     if non PIC is linked to a shared library and complain, but I'm not
>     sure if this is possible. Comments ?

Some linkers do, and either complain or arrange for the non-PIC code
to be included in the shared library anyway, even though it may not be
able to share memory pages across multiple processes, for requiring

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