[uClibc]compiling with -fPIC
David Schleef
ds at schleef.org
Fri Oct 12 03:21:24 UTC 2001
I've noticed a significant size difference between code compiled
with -fpic and without. Specifically,
with:
-rw-r--r-- 1 root root 485172 11. Okt 16:03 libc.a
without:
-rw-r--r-- 1 ds ds 465668 11. Okt 19:57 libc.a
So it would be nice to compile libc.a without -fpic. However,
shared libraries require -fpic. Right now, I'm contemplating
compiling uClibc _twice_ for the Debian packaging, once with
-fpic and once without. I'm wondering what other libraries do,
and if it is useful to change the Makefiles to compile both
simultaneously.
As a side note, it is really easy to create a libc.so file from
a libc.a archive that only contains objects compiled with -fpic.
(That's what the Makefiles do currently.) And this has the
advantage that a simple perl script can dump the entire dependency
graph of uClibc -- the idea being that if you know all the
symbols that a collection of applications need, you can strip
down uClibc by deleting objects in the archive, and relinking
the shared object.
I'm looking for ways to a) create a libc.a (for static non-pic
linking) as well as a libc.sa (for reconstructing libc.so), b)
a way to do this with an _installed_ uClibc, i.e., a Debian
package, and c) potential ways to automate this for any
library source.
dave...
More information about the uClibc
mailing list