Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 2004 00:33:01 -0800
From:      Peter Wemm <peter@wemm.org>
To:        freebsd-amd64@freebsd.org
Subject:   Re: CFLAGS+= -fPIC per default?
Message-ID:  <200402220033.01795.peter@wemm.org>
In-Reply-To: <4CC57F17-64E9-11D8-ACAA-000A95BAD088@raisdorf.net>
References:  <BD6DAE5F-64A6-11D8-ACAA-000A95BAD088@raisdorf.net> <c195u3$2q5s$1@kemoauc.mips.inka.de> <4CC57F17-64E9-11D8-ACAA-000A95BAD088@raisdorf.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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
> honoring
> 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 
right. 
-- 
Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402220033.01795.peter>