<div dir="ltr">And FYI, I've removed the attribute to try to force TLS models in r227511.<div><br></div><div>Thanks to everyone tracking down this twisty maze of interactions.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 29, 2015 at 6:44 AM, Ulrich Weigand <span dir="ltr"><<a href="mailto:Ulrich.Weigand@de.ibm.com" target="_blank">Ulrich.Weigand@de.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Alan Modra <<a href="mailto:amodra@gmail.com">amodra@gmail.com</a>> wrote on 29.01.2015 03:50:58:<br>
<span class="">> On Thu, Jan 29, 2015 at 08:28:17AM +1030, Alan Modra wrote:<br>
> > On Wed, Jan 28, 2015 at 05:02:06PM +0100, Ulrich Weigand wrote:<br>
> > > Note how the original instruction marked with R_PPC64_GOT_TLSLD16_LO<br>
sets<br>
> > > register r29, while the linker-generated replacement sets r3.<br>
Looking at<br>
> > > the linker code, the addis "r3, r13, ..." seems to be simply<br>
hard-coded,<br>
> > > which works only if the original instruction sets register r3.<br>
> ><br>
> > Ouch.  Will fix.<br>
><br>
> Fixed with <a href="https://sourceware.org/ml/binutils/2015-01/msg00318.html" target="_blank">https://sourceware.org/ml/binutils/2015-01/msg00318.html</a><br>
<br>
</span>Thanks!<br>
<span class=""><br>
> > > There is also a linker optimination for the general-dynamic case, but<br>
> > > from reading the BFD sources this seems to work correctly for any<br>
> > > target register and doesn't just assume r3.  Alan, is that right?<br>
> ><br>
> > No, I think that is also broken.<br>
><br>
> Actually, looking at it again after I'd woken up properly, the general<br>
> dynamic case is good.<br>
<br>
</span>Actually, experiment shows that it was broken after all :-)<br>
<br>
More specifically, the general-dynamic to *local-exec* optimization<br>
was broken, since it uses the same code path as the local-dynamic<br>
to local-exec optimization.  There is a separate general-dynamic to<br>
initial-exec optimization, which ought to be fine.<br>
<br>
But with Chandler's change, the linker actually used the general-dynamic<br>
to local-exec optimization (since the output is an executable file, and<br>
not a shared library), and thus it is still broken.<br>
<br>
<br>
Bye,<br>
Ulrich<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>