[gccsdk] PIC code in static libraries
Peter Naulls
peter at chocky.org
Wed Aug 5 18:44:33 PDT 2009
Peter Naulls wrote:
>
> This was mentioned earlier, but there was no follow up. In any case,
> the situation is pretty bad, and it's purely by chance this hasn't
> been a serious issue until now.
>
> The culprit is libtool's handling of "convenience libraries", which
> are used in a number of projects (glib, gtk, xlib) to build
> intermediate libraries from sub directory projects - these libraries,
> although .a archives, contain only PIC objects, and they end up in
> the static .a at the level above when it is created.
I've put in a fix via a wrapper to 'ar', which generates additional
static archives. This seems to work in the vast majority of cases -
certainly in all the ones I mention above. There's still a couple
of libraries which slip through the net (they may not use the
requested installer), so I'll address those in due course.
For similar cases, John has said he'll take a look at the linker
to try and have it reject cases of mixing PIC and non-PIC code. This
will avoid problems later on with mystery crashes.
More information about the gcc
mailing list