[PATCH] D17974: [lto] Record whether a variable is TLS.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 16:24:13 PST 2016


silvas created this revision.
silvas added a reviewer: rafael.
silvas added subscribers: llvm-commits, Bigcheese.
Herald added a subscriber: joker.eph.

I'm not sure whether the `if (GV)` is needed; I'm just following the
code above which is checking the same thing. No tests fail when I remove
both `if (GV)` checks.
Rafael, any ideas?

http://reviews.llvm.org/D17974

Files:
  ELF/InputFiles.cpp
  test/ELF/lto/Inputs/tls-mixed.s
  test/ELF/lto/tls-mixed.ll

Index: test/ELF/lto/tls-mixed.ll
===================================================================
--- /dev/null
+++ test/ELF/lto/tls-mixed.ll
@@ -0,0 +1,10 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t1.o
+; RUN: llvm-mc %p/Inputs/tls-mixed.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux
+; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t.so -shared
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Should not encounter TLS-ness mismatch for @foo
+ at foo = external thread_local global i32, align 4
Index: test/ELF/lto/Inputs/tls-mixed.s
===================================================================
--- /dev/null
+++ test/ELF/lto/Inputs/tls-mixed.s
@@ -0,0 +1,5 @@
+.globl foo
+.section .tbss,"awT", at nobits
+.p2align 2
+foo:
+.long 0
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -467,6 +467,8 @@
     } else {
       Body = new (Alloc) DefinedBitcode(NameRef, IsWeak, Visibility);
     }
+    if (GV)
+      Body->IsTls = GV->isThreadLocal();
     SymbolBodies.push_back(Body);
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17974.50088.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160309/e2e958d0/attachment.bin>


More information about the llvm-commits mailing list