This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: is -fPIC safe for executable programs, or must -fPIE be used?
- From: Didier Kryn <kryn at in2p3 dot fr>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 26 Mar 2016 10:58:42 +0100
- Subject: Re: is -fPIC safe for executable programs, or must -fPIE be used?
- Authentication-results: sourceware.org; auth=none
- References: <CAC4O8c-FrGrpKUQptyYzZpu8Zr9afmyWaRHTFLRLDMyA9QZtaw at mail dot gmail dot com> <CAH8yC8kqVP-hwtWm4TXcg9b0brm4UvH8Wq4xBGZyAoEb2E11-w at mail dot gmail dot com> <CAC4O8c-8Y3EJD6OmKEM8p7iYanmQ9S5z36gmhRNL9+eZ5H0nDw at mail dot gmail dot com>
Le 25/03/2016 20:04, Britton Kerin a Ãcrit :
-pie
--pic-executable Create a position independent executable.
This is currently only supported on ELF platforms. Position
independent executables are similar to shared libraries in that they
are relocated by the dynamic linker to the virtual address the OS
chooses for them (which can vary between invocations). Like normal
dynamically linked executables they can be executed and symbols
defined in the executable cannot be overridden by shared libraries.
Hello.
Isn't there a contradiction in the sentence
Like normal
dynamically linked executables they can be executed and symbols
defined in the executable cannot be overridden by shared libraries.
The first part of the sentence seeems to mean they can be
dynamically linked (they are just abnormal dynamically linked programs)
and the second part seems to mean the dynamic linking will fail -- my
understanding of dynamic linking being that it relies precisely on
overriding symbols.
Thanks if you can clarify that.
Didier