[PATCH] Introduce new gold plugin option "relocation-pic"

Alexey Volkov avolkov.intel at gmail.com
Thu Apr 24 06:30:07 PDT 2014


2014-04-24 16:58 GMT+04:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:

> On 24 April 2014 08:42, Alexey Volkov <avolkov.intel at gmail.com> wrote:
> > On Android user doesn't have to pass -fPIC or -fPIE option.
> > Clang is turning on PIC mode (not PIE) without any user input when
> targeting to Android.
> > However when producing executable compiler has no special options (-pie)
> for linker.
> > So linker produces executable from PIC objects without -pie option.
> > So final executable is not pure PIE, it's executable formed from PIC
> code.
> > This is what we have now on Android.
> > Adding -pie option to linker could change produced code which could be
> surprising to user.
> > Since -pie needed only to fix or workaround this bug I propose to have
> -pie only with LTO enabled.
>
> But that just opens more questions:
>
> * Why are we compiling with -fPIC when not requested?
>
Since on Android only PIC code is supported.
One reason for this is unsupported COPY relocation on Android.

> * If the final executable is not to be PIE, why do we hit an issue
> with LTO when producing a non PIE executable?
>
Without LTO PIC code is produced but executable is not PIE and this works.
But with LTO compiler produced non-PIC code causing runtime failures on
Android.

>
> Cheers,
> Rafael
>



-- 
Alexey Volkov
Intel Corporation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140424/fe868045/attachment.html>


More information about the llvm-commits mailing list