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
This commit is contained in:
Peter Collingbourne 2018-07-18 00:21:40 +00:00
parent 0f5d5fae93
commit fc50498ced
2 changed files with 5 additions and 1 deletions

View File

@ -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));
}

View File

@ -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