CFLAGS+= -fPIC per default?
peter at wemm.org
Sun Feb 22 00:33:03 PST 2004
On Saturday 21 February 2004 07:43 pm, Hendrik Scholz wrote:
> On Feb 21, 2004, at 9:59 PM, Christian Weisgerber wrote:
> > Why are these shared objects not built with -fPIC in the first
> > place?
> Ask the authors of the third party applications :)
> Most architectures don't need -fPIC and/or it slows them down (thanks
> for the
> comment Peter!).
Yes, exactly. Some folks thought it would be an idea to add a flag to
libtool to force it to link non-pic code into shared libraries.
Essentially this reduces the sharability since we do relocations on the
text segment, but the flipside is that its faster on i386 and on some
libraries they figured it was worth burning extra memory that would be
wasted by not using -fPIC.
> The ports I've dealt with either use a hand written Makefile without
> CFLAGS set in the environment or without having -fPIC set since i386
> (I guess that
> is what most of the guys test and run their stuff on) doesn't need
> it. Ports utilizing GNU configure may check if -fPIC is supported but
> usually don't
> set it since it's not needed on the developers system.
The real shame is that the libtool/autoconf tests that attempt to
determine if -fpic can be safely left out, are not tripping because the
test code they use is too simple and doesn't cause the relocations
types to be emitted that cause all the trouble.
ie: even the ones that actually test it with autconf aren't doing it
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5
More information about the freebsd-amd64