]> granicus.if.org Git - llvm/commitdiff
CodeGen: Don't create address significance table entries for thread-local variables.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 18 Jul 2018 00:21:40 +0000 (00:21 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 18 Jul 2018 00:21:40 +0000 (00:21 +0000)
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

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
test/CodeGen/X86/addrsig.ll

index 30c95a7138d1a5aeeeffe0bfea20d90b79db0f80..1b429331a35b88739d7db29c3c1da05d9ee9dd72 100644 (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));
   }
 
index c8759764ad6bff8859a9ba41e67ba76380e703cf..0bb50cb013fae47dd6ca6d3d6df254f0e134c3c3 100644 (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