From: Peter Collingbourne Date: Wed, 18 Jul 2018 00:21:40 +0000 (+0000) Subject: CodeGen: Don't create address significance table entries for thread-local variables. X-Git-Tag: llvmorg-7.0.0-rc1~1192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc50498ced7f85279b901fce302d01e558c74c7d;p=platform%2Fupstream%2Fllvm.git CodeGen: Don't create address significance table entries for thread-local variables. The presence of these symbols in the symbol table can cause symbol type mismatch errors (or undefined symbol errors on emulated TLS targets) and they can't be ICF'd anyway. llvm-svn: 337338 --- diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 30c95a7..1b42933 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1533,7 +1533,8 @@ bool AsmPrinter::doFinalization(Module &M) { // Emit address-significance attributes for all globals. OutStreamer->EmitAddrsig(); for (const GlobalValue &GV : M.global_values()) - if (!GV.getName().startswith("llvm.") && !GV.hasAtLeastLocalUnnamedAddr()) + if (!GV.isThreadLocal() && !GV.getName().startswith("llvm.") && + !GV.hasAtLeastLocalUnnamedAddr()) OutStreamer->EmitAddrsigSym(getSymbol(&GV)); } diff --git a/llvm/test/CodeGen/X86/addrsig.ll b/llvm/test/CodeGen/X86/addrsig.ll index c875976..0bb50cb 100644 --- a/llvm/test/CodeGen/X86/addrsig.ll +++ b/llvm/test/CodeGen/X86/addrsig.ll @@ -25,6 +25,9 @@ declare void @f3() unnamed_addr ; CHECK-NOT: .addrsig_sym g3 @g3 = external unnamed_addr global i32 +; CHECK-NOT: .addrsig_sym tls +@tls = thread_local global i32 0 + ; CHECK: .addrsig_sym a1 @a1 = alias i32, i32* @g1 ; CHECK-NOT: .addrsig_sym a2