[PATCH] D10524: Clang/driver: emulated TLS mode.

Chih-Hung Hsieh chh at google.com
Tue Jul 14 12:01:48 PDT 2015


chh added a comment.

Thanks for the suggestion about FileCheck prefixes.
I will simplify the code soon.

Gcc has configuration flags to enable or disable TLS.
It's emutls model/pass can be selected through configuration:

  https://github.com/gcc-mirror/gcc/blob/master/gcc/tree-emutls.c

I have not found a compile time flag to select emulated vs native TLS models,
although that should be doable.

When Android gcc is configured to use the emulated TLS model,
TLS attributes like __attribute__((tls_model("local-dynamic")))
are silently ignored. The emulated model is used.
Lacking warning is bad, and it might be accepted only
when a target really cannot support both native and native TLS.

Android supports only emulated TLS now, but should be able to support both
in the future. To replace Android gcc with llvm, I would really like to have
a compile time flag instead of two copies of Android llvm to support/test
both TLS models. The -ftls-model seems to be the flag to add such a feature.
Then it follows to allow 5 tls_model attributes.

I see that clang's -ftls-model flag sets default, but does not overwrite
__attribute__((tls_model("local-dynamic"))). So I think an easy
implementation is to do the same for the -ftls-model=emulated flag.

The alternative is a new compile-time flag to enable emulated TLS and overrides all other 4 native tls_model attributes, and give warnings. This new flag will be needed at both clang/driver level and llvm IL level, right? Is that what you want? Any suggestion for the name or mechanism?


http://reviews.llvm.org/D10524







More information about the llvm-commits mailing list