[PATCH] -fpie/-fPIE/-pie GCC support
Joseph S. Myers
jsm28@cam.ac.uk
Mon Jun 2 20:16:00 GMT 2003
On Mon, 2 Jun 2003, Jakub Jelinek wrote:
> This patch is the GCC side of Position Independent Executable support
> which has been commited this week to binutils trunk.
> The patch adds -pie option which is for linking, similarly to -shared.
> This may select different crt files etc. and pass appropriate options
> down to the linker.
Where is the rationale / documentation for when PIE code is useful? Is
this something that is deliberately not added to the manual because if
it's useful to you then you'll already understand it and why it's useful?
> or not). ATM the difference is in binds_local - like in non-fpic code
> GCC can assume any non-common object defined in the same module, even if
> not static, will be in the same binary (which means GOT relative accesses
> to such variables, ability to inline non-static functions at -O3, etc.).
There ought then to be testcases (that with PIC the compiler assumes
functions can be overridden, with PIE it doesn't).
You change many specs to define __PIC__ and __pic__ for PIE as well. I
can't find documentation of these macros: is the previously intended
definition (that existing code presumes) that they are defined for
position-independent code, as distinguished from code for shared
libraries? Could you move the definition of these macros out of specs and
into a single place in the compiler, depending on flag_pic etc.?
--
Joseph S. Myers
jsm28@cam.ac.uk
More information about the Gcc-patches
mailing list