Re: updating ebuilds for alpha, incude -fPIC.
Will Woods <[email protected]>
| Newsgroups | gmane.linux.gentoo.alpha |
|---|---|
| Message-ID | <[email protected]> |
Okay, here's the deal with -fPIC: PIC stands for "Position Independent Code". This means that the code can be loaded into any address in memory and still work okay. All the pointers are stored as addresses relative to their block of code, rather than absolute addresses in memory. This requires a little compiler overhead to convert the fixed addresses to relative ones, and then a little runtime overhead to resolve these relative addresses to actual memory locations. It also makes the objects a little bigger, as it has to keep extra information to help the loader fill in unresolved addresses at runtime. Here's the important bit: All code in shared librares must be PIC. On certain architectures (like, I believe, i386), because of the way memory stuff is laid out, all code is automatically position independent. This is why people in x86-land sometimes forget to force shared library code to be compiled with -fPIC. Thins like libtool handles this automatically, so it usually isn't a problem, but there are other cases where it is. Such as xfree. Sigurd Stordal wrote: [Wed Jun 25 2003, 07:24:16AM EDT] >I've seen for ebuilds like xfree 4.3, that there is no -fPIC in the >allowed cflags, this makes sense for x86, but if I have understood >right, it's nearly a requirement for the alpha architecture. It's a requirement for *shared libraries* on alpha. We don't want to compile everything with -fPIC, because that would make everything bigger and slower. Only the parts that are going into shared libraries need -fPIC. The problem with xfree 4.3 was that a new module (shared object) was including parts of libz.a (static library, not normally compiled with -fPIC). Compiling libz.a with -fPIC fixes the problem, and that's the fix we chose to use. If you merged xfree-4.3.0-r3 with -fPIC in CFLAGS, you may want to re-merge now that there's a bugfix. Hope this clears things up a bit. -will (for more info:) http://www.llnl.gov/casc/components/docs/users_guide/node56.html http://sources.redhat.com/autobook/autobook/autobook_71.html -- [email protected] mailing list