[llvm-dev] using emulated-tls on Darwin 8, 9, 10

Ken Cunningham via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 9 22:52:08 PST 2018


On 2018-12-08, at 2:27 PM, Ken Cunningham wrote:

> And then we should be in business, and all systems will have thread_local .


All that being sorted out, we now have libc++ 7.0.0 and libc++abi  built and being used with emulated-tls support  on darwin < 11 now. Thanks!

The last bit of this I plan to sort out would be how to tweak the following patch so that __cxa_thread_atexit would be called based on the -femulated-tls flag rather than based on the MacOSXVersion. That way emulated-tls could be used/tested on any OS version. -- Ken



==========================
--- a/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp.orig	2018-10-02 18:31:17.000000000 -0700
+++ b/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp	2018-10-02 18:32:35.000000000 -0700
@@ -2255,7 +2255,7 @@
const char *Name = "__cxa_atexit";
if (TLS) {
  const llvm::Triple &T = CGF.getTarget().getTriple();
-    Name = T.isOSDarwin() ?  "_tlv_atexit" : "__cxa_thread_atexit";
+    Name = (T.isOSDarwin() && !T.isMacOSXVersionLT(10, 7)) ?  "_tlv_atexit" : "__cxa_thread_atexit";
}




More information about the llvm-dev mailing list