<div dir="ltr">Over one year passed now,  did anybody made any progress regarding this issue?</div><div class="gmail_extra"><br><div class="gmail_quote">On 9 February 2017 at 16:33, Gaetano Checinski <span dir="ltr"><<a href="mailto:gaetano.checinski@gmail.com" target="_blank">gaetano.checinski@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm looking currently into a <a href="https://mailtrack.io/trace/link/60b02baa5e1b3d7ffe6fbb428b343be17c58c583?url=https%3A%2F%2Fgithub.com%2FJuliaLang%2Fllvm%2Fcommit%2Fa9e17b7f47f5afa9683fc8cfeff7020b2ff4a8b2%23diff-0fa8ca8690e36a8dfd05f6b751955164R339&signature=222c65b9d92c011f" target="_blank">patch</a> which has been written for JuliaLang and is supposed to fix TLS for linux.<div>Unfortunately it is based on llvm3.6 and uses RuntimeDyLdELF::findGOTEntry.</div><div>Is there any equivalent method in llvm4.0 ?</div><div><br></div><img width="0" height="0" class="m_1235976105488312784mailtrack-img" src="https://mailtrack.io/trace/mail/e171aaae20f20d20789bd0ae7515cf5d2c2ffccf.png?u=931501"></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-02-08 19:40 GMT+00:00 Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Adding llvm-dev back to list]<br>
<br>
On 8 February 2017 at 11:12, Gaetano Checinski<br>
<span><<a href="mailto:gaetano.checinski@gmail.com" target="_blank">gaetano.checinski@gmail.com</a>> wrote:<br>
> Thanks for sharing your insights,<br>
> so in theory i could build an llvm pass that calls TargetLowering::LowerToTLSEmul<wbr>atedModel for each llvm::Function and it should work if i link a runtime that provides __emultls_get_address.<br>
<br>
</span>I'm afraid not, that function is called as part of converting from a<br>
Function to a MachineFunction. It operates on a completely different<br>
representation to normal LLVM IR. The only way to trigger it is to set<br>
the right field in the TargetOptions.<br>
<span><br>
> >It's a missing feature/bug in the x86 backend. The specific problem is<br>
> >that it seems we don't support thread-local variables with what Clang<br>
> >& GCC would call "-mcmodel=large".<br>
><br>
> Would it be a better approach to fix this issue ?<br>
<br>
</span>Yes, I think that'd be the proper fix for the issue. It's possible the<br>
JIT parts don't support TLS at all yet either, which would mean we<br>
have to implement it there.<br>
<span><br>
> How difficult would it be ?<br>
<br>
</span>I don't think there are any fundamental difficulties; the ABI already<br>
exists because GCC can cope. On the JIT side, it'll be a case of<br>
supporting some relocations (pretty simple) and getting the output<br>
object's thread-local sections registered with the system somehow<br>
(more difficult, I'm not sure what each platform's callbacks are).<br>
<br>
It's probably measured in days even for someone who knows many of the<br>
details already though.<br>
<br>
Cheers.<br>
<span class="m_1235976105488312784HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:12.8px">Regards,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Gaetano Checinski</div><div style="font-size:12.8px"><span style="font-size:12.8px">Founder of Loopperfect</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><a href="https://loopperfect.com" target="_blank">https://loopperfect.com</a></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><a href="https://buckaroo.pm" target="_blank">https://buckaroo.pm</a></span></div></div></div></div></div>
</div>