[Top][All Lists]

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

RE: -fpic instead of -fPIC

From: Joakim Tjernlund
Subject: RE: -fpic instead of -fPIC
Date: Mon, 6 Jun 2005 19:21:17 +0200

> Hi Joakim,
> * Joakim Tjernlund wrote on Mon, Jun 06, 2005 at 04:10:31PM CEST:
> > 
> > I want to use -fpic instead of -fPIC on a powerpc(linux) target since
> > that generates smaller and faster libs.  But I can't find out how to
> > make libtool use -fpic. I don't want to do local changes to the
> > installed libtool.  build host is linux/x86.
> The setting of pic_flag is hard-wired in AC_LIBTOOL_PROG_COMPILER_PIC in
> libtool.m4 now, if that's what you are looking for.

OK, will look at that some more. I don't automake, autoconf and libtool very 
well so I need
a liite guidance here. Can I just run aclocal and modify the generated 
aclocal.m4? I would 
then commit aclocal.m4 to CVS and use that when building our libs.

Is there a better way?

> But how would you have Libtool find out when it will be used for large
> sources for which -fpic will fail?

This is mainly for our own development of onboard SW for a embedded target and
we want to save space.

> (Note I *could* imagine some kind of parametrization a la `-small-pic',
> but I'll tell you right away that the amount of possible breakage is
> huge, huge, and dangerous, and hard to find only after hours of
> compilation; and the resulting fights with users..)

hmm, but in some cases it is justified. Think embedded products.

> Two questions to ponder before you think about -fpic: Have you measured
> the speed impact of -fpic vs -fPIC?  Please show, I'm interested!

Nope, but i did look at the libs with readelf -a and found that accesses to a 
variables seems to generates a reloc per access to that global variable(why?) 
and that
can quickly waste space.

> If the difference is noticeable: Have you slapped the library author
> with Drepper's dsohowto.pdf yet?  If so, please share with us his/her
> reasoning to ignore it.   :)

Nope, not yet. Will have to slap myself and my team in that case :)
I have read that doc and learned a lot from it. However even Drepper seems
to like -fpic in one case: glibc for ppc is compiled with -fpic.
PPC can handle big libs even with -fpic.

> Regards,
> Ralf

reply via email to

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