[PATCH] Clang/driver: emulated TLS mode.

Chih-hung Hsieh chh at google.com
Mon Jun 29 13:45:25 PDT 2015


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.

The existing -ftls-model looks like a natural hook to me.
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.


On Mon, Jun 29, 2015 at 12:30 PM, Joerg Sonnenberger <
joerg at britannica.bec.de> wrote:

> On Mon, Jun 29, 2015 at 07:20:12PM +0000, Chih-Hung Hsieh wrote:
> > 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.
> > Please see also the comments in the llvm bug:
> > https://llvm.org/bugs/show_bug.cgi?id=23566#c4
>
> That doesn't answer why it needs to be a new TLS model. Why can't you
> lower the TLS access differently if the environment or whatever is
> android? It would even be a generic TLS emulation pass that rewrites
> them into the appropiate function calls. That would require no changes
> to Clang at all, it seems.
>
> Joerg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150629/c42b79cb/attachment.html>


More information about the llvm-commits mailing list