Skip to content

Commit

Permalink
CodeGen: Don't create address significance table entries for thread-l…
Browse files Browse the repository at this point in the history
…ocal 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337338 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Jul 18, 2018
1 parent b5b60c3 commit 70df6e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
3 changes: 3 additions & 0 deletions test/CodeGen/X86/addrsig.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 70df6e9

Please sign in to comment.