Question about very old patch

Marc Espie
Sun Sep 17 06:22:00 GMT 2000

Mon Dec  4 22:17:37 1995  Jason Merrill  <>

        * gcc.c (LIBGCC_SPEC): Do link with libgcc when -shared.
        * alpha.h (LIBGCC_SPEC): Remove.
        * linux.h (LIBGCC_SPEC): Remove.
        * svr4.h (LIBGCC_SPEC): Remove.
        * i386/t-crtpic (TARGET_LIBGCC2_CFLAGS): Use -fPIC.
        * t-pa (TARGET_LIBGCC2_CFLAGS): Use -fPIC.
        * sparc/t-sunos41 (TARGET_LIBGCC2_CFLAGS): Use -fPIC.
        * sparc/t-sol2 (TARGET_LIBGCC2_CFLAGS): Use -fPIC.
        * configure (i386-linux): Use i386/t-crtpic.

I know, this is positively ancient, but could you outline what prompted
that decision, whether it still makes sense, etc ?

I noticed it because OpenBSD is massively switching to using gcc -shared
to build libraries (failure in lib Obj-C and various C++ libraries due
to the need to collect constructors) and I got a large number of RRS
text relocations from our linker.

I assume I need to use -fPIC for libgcc.a.   This is probably as easy as
it goes, but I want to know the reason.

Actually, I also want to clarify things because gcc documentation was
not updated, and the LIBGCC_SPEC description is at odds with what has
been going on for... five years !   So it might make sense to flesh out
a small paragraph that explains why this is a good idea.
	Marc Espie		
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'

More information about the Gcc mailing list