<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-24 16:58 GMT+04:00 Rafael EspĂ­ndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 24 April 2014 08:42, Alexey Volkov <<a href="mailto:avolkov.intel@gmail.com">avolkov.intel@gmail.com</a>> wrote:<br>

> On Android user doesn't have to pass -fPIC or -fPIE option.<br>
> Clang is turning on PIC mode (not PIE) without any user input when targeting to Android.<br>
> However when producing executable compiler has no special options (-pie) for linker.<br>
> So linker produces executable from PIC objects without -pie option.<br>
> So final executable is not pure PIE, it's executable formed from PIC code.<br>
> This is what we have now on Android.<br>
> Adding -pie option to linker could change produced code which could be surprising to user.<br>
> Since -pie needed only to fix or workaround this bug I propose to have -pie only with LTO enabled.<br>
<br>
</div></div>But that just opens more questions:<br>
<br>
* Why are we compiling with -fPIC when not requested?<br></blockquote><div>Since on Android only PIC code is supported.</div><div>One reason for this is unsupported COPY relocation on Android.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

* If the final executable is not to be PIE, why do we hit an issue<br>
with LTO when producing a non PIE executable?<br></blockquote><div>Without LTO PIC code is produced but executable is not PIE and this works.</div><div>But with LTO compiler produced non-PIC code causing runtime failures on Android.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Volkov<div>Intel Corporation</div></div>
</div></div>