Author: uweigand Date: Thu Jan 29 13:08:51 2015 New Revision: 227480 URL: http://llvm.org/viewvc/llvm-project?rev=227480&view=rev Log: [PowerPC] Work around TLS linker bug
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. Bug is fixed here: https://sourceware.org/ml/binutils/2015-01/msg00318.html Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/ppc-features.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=227480&r1=227479&r2=227480&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 29 13:08:51 2015 @@ -7515,6 +7515,13 @@ void gnutools::Link::ConstructJob(Compil 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()); Modified: cfe/trunk/test/Driver/ppc-features.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-features.cpp?rev=227480&r1=227479&r2=227480&view=diff ============================================================================== --- cfe/trunk/test/Driver/ppc-features.cpp (original) +++ cfe/trunk/test/Driver/ppc-features.cpp Thu Jan 29 13:08:51 2015 @@ -132,8 +132,10 @@ // 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" _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
