[Cygwin] Enable TLS as emutls.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 21 Dec 2015 02:37:23 +0000 (02:37 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 21 Dec 2015 02:37:23 +0000 (02:37 +0000)
It resolves clang selfhosting with std::once() for Cygwin.

FIXME: It may be EmulatedTLS-generic also for X86-Android.
FIXME: Pass EmulatedTLS to LLVM CodeGen from Clang with -femulated-tls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256134 91177308-0d34-0410-b5e6-96231b3b80d8

docs/ReleaseNotes.rst
lib/Target/X86/X86ISelLowering.cpp

index 8b33b6b..b3f7c00 100644 (file)
@@ -105,6 +105,14 @@ Changes to the PowerPC Target
  During this release ...
 
 
+Changes to the X86 Target
+-----------------------------
+
+ During this release ...
+
+* TLS is enabled for Cygwin as emutls.
+
+
 Changes to the OCaml bindings
 -----------------------------
 
index 241d8bb..d2a20a1 100644 (file)
@@ -12258,6 +12258,12 @@ SDValue
 X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const {
 
   GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(Op);
+
+  // Cygwin uses emutls.
+  // FIXME: It may be EmulatedTLS-generic also for X86-Android.
+  if (Subtarget->isTargetWindowsCygwin())
+    return LowerToTLSEmulatedModel(GA, DAG);
+
   const GlobalValue *GV = GA->getGlobal();
   auto PtrVT = getPointerTy(DAG.getDataLayout());