[NCLUG] extracting library from statically linked executable

Stephen Warren swarren at wwwdotorg.org
Wed Dec 20 19:30:57 MST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sean Reifschneider wrote:
> On Wed, Dec 20, 2006 at 03:09:36PM -0700, Stephen Warren wrote:
>> In theory, if the original objects were compiled "position independant",
> 
> Can you have a statically linked binary using a PIC compiled library?  I've
> only ever used PIC for .so and non-PIC for static linking.  Though, I admit
> that I don't know if that's a rule for static compilation or just a
> convention.  It's definitely a rule for .so, AFAIK.

Yes.

PIC code will work anywhere.

For almost all CPUs, dynamic libs *must* be PIC to work.

For x86 at least, the architecture and code generation is such that you
can actually create working dynamic libs without building the code PIC.
However, some of the (rarely used) semantics of dynamic libs might be
lost unless you build PIC (such as the exe, or other dynamic libs, being
able to re-define global symbols defined in the dynamic lib)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFifHghk3bo0lNTrURAiXIAJ4yZocJ/5LoO+Bh4FvjsD5v6y8QYwCfQhL0
umtR1hCkvzZx2dIx+l/GQSY=
=A7ot
-----END PGP SIGNATURE-----



More information about the NCLUG mailing list