forked from OSchip/llvm-project
[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 llvm-svn: 227480
This commit is contained in:
parent
d5bb7e142b
commit
f32a1acee8
|
@ -7515,6 +7515,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());
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue