<div dir="ltr"><div>I see your question now. At the beginning I was looking for a way to set up some configuration flag too for *-*-android targets to tell LLVM how to lower TLS code. Trying to recognize "android" environment in LLVM seems too restricted, as the emulated model could be useful to any target.<br></div><div><br></div><div>The existing -ftls-model looks like a natural hook to me.</div><div>This allows any target to support multiple TLS models and let users choose which model to compile. The __attribute__((tls_model(...)) syntax seems also a nice feature to keep, so I added the "emulated" mode into both -ftls-model and tls_model attributes. As you can see in this patch and the other LLVM patch, I was testing multiple models at the same time.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 29, 2015 at 12:30 PM, Joerg Sonnenberger <span dir="ltr"><<a href="mailto:joerg@britannica.bec.de" target="_blank">joerg@britannica.bec.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Jun 29, 2015 at 07:20:12PM +0000, Chih-Hung Hsieh wrote:<br>
> This patch should keep the default clang/llvm configuration for all targets, but add the necessary -ftls-model=emulated flag for Android users that need TLS.<br>
> Please see also the comments in the llvm bug:<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23566-23c4&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=VomlaievOzCkpf4lwEyGvPJrxvpnqPu0F_EZkVCw-_c&s=By1VNQsMdwevTty9HJ3gsBuCdbDDucgdCU913_GJssg&e=" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=23566#c4</a><br>
<br>
</span>That doesn't answer why it needs to be a new TLS model. Why can't you<br>
lower the TLS access differently if the environment or whatever is<br>
android? It would even be a generic TLS emulation pass that rewrites<br>
them into the appropiate function calls. That would require no changes<br>
to Clang at all, it seems.<br>
<span class="HOEnZb"><font color="#888888"><br>
Joerg<br>
</font></span></blockquote></div><br></div>