[Clc-crux64] to -fPIC or not to -fPIC

Jeremy Jones jeremy at samnjack.com
Wed Apr 20 15:27:32 UTC 2005


All right, I'm a little bothered by my current build, w/out -fPIC in the
CFLAGS/CXXFLAGS.  I've had to recompile so many packages after the fact,
when another package comes and tells me to recompile so-an-so lib
w/-fPIC, that I'm considering putting it back in the pkgmk.conf and
recompiling base/opt.

Pro:

1. Don't have to worry about adding "export CFLAGS="$CFLAGS -fPIC" to
every other Pkgfile (seems to be required with a boatload of the
multimedia apps I've been compiling)

2. Isn't position independent code a Good Thing(tm)?  Not being schooled
in the black arts of c programming, I have a hard time explaining to
myself why, but I think it has to do with where objects can be loaded in
a system's address space...

Con:

1. Ummm...  Gentoo-wisdom says not to add it to CFLAGS/CXXFLAGS.  Anyone
know why?

2. From
http://www.linux.duke.edu/~mstenner/free-docs/autobook-1.3/autobook_71.html
"PIC objects are usually slightly larger and slower at runtime than the
equivalent non-PIC object".  Slightly larger doesn't bother me much --
probably few of us running x86_64 processors w/tight disk space anyway,
right?  Slightly slower -- well, although my amd64 can probably afford
slightly slower, I would like to squeeze every ounce of performance I
can out of this box...

So, I'm taking recommendations here.  Does anyone care enough one way or
the other to convince me of their position?

Jeremy





More information about the crux64 mailing list