Subject: libgcc as PIC [was Re: libtool, C++ and shared objects]
To: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
From: Nick Hudson <nick@nthcliff.demon.co.uk>
List: tech-pkg
Date: 08/18/2001 09:07:57
On Saturday 18 August 2001 02:40, Hubert Feyrer wrote:
> Hi,
>
> I just run into an annoying feature of libtool. I'm trying to compile a
> xmms-plugin, which works as shared object (.so, no version). As the code
> is C++, the shared object needs to be linked against libgcc so
> __builtin_new is resolved properly. If I add -lgcc to the c++ command that
> libtool runs, this works fine. If I add the same -lgcc line to the libtool
> command linking things, libtool warns me that I'll need a libgcc, but then
> discards(!) the one I give it on the command line explicitly.
>
> Is there something that can be done against that?
The real problem here is that libgcc is not available as libgcc.so or even
libgcc.a (with the objects compile -fPIC)
There is a workaround that involves using --export-dynamic on the binary that
dlopens the xmmx-plugin DSO and possibly --whole-archive -lgcc
-no-whole-archive. See perl-base/patches/patch-ab
Its not pretty and has the downside that anything that needs to dlopen the
DSO has to have the same fix.
Todd is supposed to be fixing this in the new toolchain.
Nick