is -fPIC safe for executable programs, or must -fPIE be used?

Didier Kryn kryn@in2p3.fr
Sat Mar 26 09:58:00 GMT 2016


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



More information about the Gcc-help mailing list