[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtool, -fPIC and .so libraries

From: Alexandre Oliva
Subject: Re: libtool, -fPIC and .so libraries
Date: 14 Nov 2000 03:21:58 -0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

On Nov 14, 2000, Michel LESPINASSE <address@hidden> wrote:

> * libtool does not want to build an x11 output plugin, it builds a .a
> file instead of a .so ... The reason is that some x11 libraries like
> libXxf86dga are only distributed as .a files, so libtool does not want
> to duplicate the code in there and build a .so plugin from it.
> gcc -shared knows how to do it, but libtool does not.

Try libtool 1.3.5, or some CVS version.  I'm pretty sure the
restriction on not linking .a files into shared libraries was lifted
for GNU/Linux on some architectures such as x86.  It won't work on
*all* OSs, though.

> * libtool's insistance on using -fPIC for shared objects is sometimes
> annoying.

Some platforms just don't support non-PIC code in shared libraries,
and one of the benefits of shared libraries, which is that of allowing
multiple processes to share memory pages of .text, can only be
realized when they are PIC.  We might offer the possibility of
creating shared libraries out of non-PIC code, though, on platforms
that have deplibs_check_method=pass_all.  Maybe -prefer-non-pic
already does that, in the CVS tree?  If it doesn't, and you feel like
contributing this, I suggest using this flag to tell libtool to prefer
non-PIC code for a shared library.

> For the mpeg decoder on x86, -fPIC is about a 10% speed hit...

Poor x86, such a register-starved machine :-)

> we do not expect to have many simultaneous mpeg decoders running

I'm not sure your assumption is a fair one.  But then, it's your
project.  I advise that you give people the option to use PIC code
when appropriate... :-)

> so we would rather build the plugin without -fPIC, which is
> totally legal.

As I wrote before, it's legal on recent versions of GNU/Linux/x86.
But it's not legal on all versions of GNU/Linux/x86, it's certainly
not legal on all platforms supported by GNU/Linux, and it's not legal
on a couple of other operating systems and architectures.

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  address@hidden,}
CS PhD student at IC-Unicamp        address@hidden,}
Free Software Evangelist    *Please* write to mailing lists, not to me

reply via email to

[Prev in Thread] Current Thread [Next in Thread]