[Bug c++/35499] Symbol resolution optimization should be separately controlled from -fPIC

2008-06-27 Thread ddenisen at altera dot com


--- 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



[Bug c++/35499] Symbol resolution optimization should be separately controlled from -fPIC

2008-03-07 Thread ddenisen at altera dot com


--- Comment #3 from ddenisen at altera dot com  2008-03-07 19:43 ---
I did read "How to write Shared Libraries" and re-read PIC section a couple of
times. Could you please clarify what am I missing here?

If symbol resolution is already controlled separately, what's the flag? I
couldn't find anything in the documentation.


-- 


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



[Bug c++/35499] Symbol resolution optimization should be separately controlled from -fPIC

2008-03-07 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2008-03-07 19:37 ---
Already controlled separately really so closing as such.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED


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



[Bug c++/35499] Symbol resolution optimization should be separately controlled from -fPIC

2008-03-07 Thread belyshev at depni dot sinp dot msu dot ru


--- Comment #1 from belyshev at depni dot sinp dot msu dot ru  2008-03-07 
19:25 ---
You need to study http://people.redhat.com/drepper/dsohowto.pdf carefully.


-- 


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