Building libstdc++ non-shared with -fpic ?

Alexandre Oliva aoliva@redhat.com
Fri Jun 30 08:36:00 GMT 2000


On Jun 30, 2000, Ingo Rohloff <lundril@gmx.net> 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
relocation.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc mailing list