]> granicus.if.org Git - clang/commitdiff
[PowerPC] Re-disable linker optimizations for now
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 6 Feb 2015 15:31:03 +0000 (15:31 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 6 Feb 2015 15:31:03 +0000 (15:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228402 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/ppc-features.cpp

index 8634ed604c6aed75571fe6e35fc91c673f96de7f..ba8b6656308a1fa0dc94f0a4d1ac49414c8c685c 100644 (file)
@@ -7625,6 +7625,13 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
         D.DyldPrefix + getLinuxDynamicLinker(Args, ToolChain)));
   }
 
+  // Work around a bug in GNU ld (and gold) linker versions up to 2.25
+  // that may mis-optimize code generated by this version of clang/LLVM
+  // to access general-dynamic or local-dynamic TLS variables.
+  if (ToolChain.getArch() == llvm::Triple::ppc64 ||
+      ToolChain.getArch() == llvm::Triple::ppc64le)
+    CmdArgs.push_back("--no-tls-optimize");
+
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
 
index 39d6357dccdac8d679b9af862b2d865a3cd8a142..feecf3ceedd1c486286eb56280076ed017a5abcc 100644 (file)
 // linker features
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_BE_LD_ARGS %s
 // CHECK_BE_LD_ARGS: "elf64ppc"
+// CHECK_BE_LD_ARGS: "--no-tls-optimize"
 
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_LE_LD_ARGS %s
 // CHECK_LE_LD_ARGS: "elf64lppc"
+// CHECK_LE_LD_ARGS: "--no-tls-optimize"