Subject: Re: Shared libraries
To: None <tv@pobox.com>
From: Ian Dall <ian@beware.dropbear.id.au>
List: tech-toolchain
Date: 07/01/1999 22:58:51
Todd Vierling writes:
 > On Sun, 27 Jun 1999, Ian Dall wrote:
 > : Finally, what happens if there is no shared library? I am thinking
 > : specifically of libgcc.a. If a, b or c call a function in libgcc.a, is
 > : it extracted from libgcc.a and linked? If so that is almost certainly
 > : wrong since libgcc.s doesn't appear to be compiled with -fpic.
 > 
 > libgcc _is_ compiled -fpic.

The error messages I get are like this:

c++ -shared -o libreg.so.1.0 ./reg.o ./VerReg.o ./vr_stubs.o  

ld: /usr/lib/libgcc.a(_op_vdel.o): RRS text relocation at 0x73a4 for "___get_eh_context"


I presume this is because libgcc.a was not compiled with -fpic. I have
confirmed that when I rebuild libgcc.a the -fpic option is *not* used.
How do I turn it on?

Also, it it really correct to compile all of libgcc.a with -fpic? If
one compiles a statically liked executable and links with libgcc.a,
then nothing will fill out the global offset table and whatever. Isn't
it an error to statically link an object compiled with -fpic?
Shouldn't there be a libgcc_pic.a which is (preferably automatically)
used whenever -shared is used?

Ian