From: Chandler Carruth Date: Thu, 29 Jan 2015 02:34:17 +0000 (+0000) Subject: [LPM] Try again to appease powerpc64 in its self host. I've been unable X-Git-Tag: llvmorg-3.7.0-rc1~13766 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cefa9ac2d66ebf16a289c5d916ed79887c93d7c;p=platform%2Fupstream%2Fllvm.git [LPM] Try again to appease powerpc64 in its self host. I've been unable to get a powerpc64 host so that I can reproduce and test this, but it only impacts that platform so trying the only other realistic option. According to Ulrich, who debugged this initially, initial-exec is likely to be sufficient for our needs and not subject to this bug. Will watch the build bots to see. If this doesn't work, I'll be forced to cut a really ugly pthread-based approach into the primary user (our stack trace printing) as that user cannot use the ThreadLocal implementation due to lifetime issues. llvm-svn: 227414 --- diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index c3c416f..f1d3024 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -394,11 +394,12 @@ #elif defined(__clang__) && defined(__powerpc64__) // Clang, GCC, and all compatible compilers tend to use __thread. But we need // to work aronud a bug in the combination of Clang's compilation of -// local-dynamic TLS and the ppc64 linker relocations which we do by forcing to -// global-dynamic (called in most documents "general dynamic"). +// global-dynamic and local-dynamic TLS and the ppc64 linker relocations which +// we do by forcing initial-exec. While that mode isn't strictly sufficient for +// all possible DSO use cases, it will usually work with glibc. // FIXME: Make this conditional on the Clang version once this is fixed in // top-of-tree. -#define LLVM_THREAD_LOCAL __thread __attribute__((tls_model("global-dynamic"))) +#define LLVM_THREAD_LOCAL __thread __attribute__((tls_model("initial-exec"))) #else #define LLVM_THREAD_LOCAL __thread #endif