------- Comment #4 from ddenisen at altera dot com  2008-06-27 20:34 -------
Here's the answer to my question (in case somebody else has the same problem):

You have to use -fPIC for compiling the executable itself (but not the shared
objects) to fix the symbol resolution problem described here. I was originally
omitting -fPIC for both SOs and EXE.

and here's some background info about -fPIC removal:

- Not using -fPIC only works on x86 architecture (but not even on x86_64)
because it allows code pages to be both writable and executable. Not using
-fPIC works because the linker creates text relocations
(http://people.redhat.com/drepper/textrelocs.html) all over code that dynamic
loader fixes up when SO/EXE is loaded. 

- Having code pages writable and executable is a huge security thread, so don't
create text relocations if you care about security of your app.

- x86_64 arch allows RIP-related addressing, making position-independent code
virtually free. So don't worry about using PIC for 64-bit apps.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35499

Reply via email to