[PATCH] D20851: [LTO] Fix (wrong) TLS attribute mismatch

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 09:44:54 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL271403: [LTO] Fix (incorrect) TLS attribute mismatch. (authored by davide).

Changed prior to commit:
  http://reviews.llvm.org/D20851?vs=59174&id=59243#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20851

Files:
  lld/trunk/ELF/LTO.cpp
  lld/trunk/test/ELF/lto/tls-preserve.ll

Index: lld/trunk/test/ELF/lto/tls-preserve.ll
===================================================================
--- lld/trunk/test/ELF/lto/tls-preserve.ll
+++ lld/trunk/test/ELF/lto/tls-preserve.ll
@@ -0,0 +1,25 @@
+; TLS attribute needs to be preserved.
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t1.o
+; RUN: ld.lld -shared %t1.o -m elf_x86_64 -o %t1
+; RUN: llvm-readobj -t %t1 | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at tsp_int = thread_local global i32 1
+
+define void @_start() {
+  %val = load i32, i32* @tsp_int
+  ret void
+}
+
+; CHECK: Symbol {
+; CHECK:   Name: tsp_int
+; CHECK-NEXT:   Value: 0x0
+; CHECK-NEXT:   Size: 4
+; CHECK-NEXT:   Binding: Global
+; CHECK-NEXT:   Type: TLS
+; CHECK-NEXT:   Other: 0
+; CHECK-NEXT:   Section: .tdata
+; CHECK-NEXT: }
Index: lld/trunk/ELF/LTO.cpp
===================================================================
--- lld/trunk/ELF/LTO.cpp
+++ lld/trunk/ELF/LTO.cpp
@@ -147,7 +147,7 @@
       Mover(*Combined) {}
 
 static void undefine(Symbol *S) {
-  replaceBody<Undefined>(S, S->body()->getName(), STV_DEFAULT, 0);
+  replaceBody<Undefined>(S, S->body()->getName(), STV_DEFAULT, S->body()->Type);
 }
 
 void BitcodeCompiler::add(BitcodeFile &F) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20851.59243.patch
Type: text/x-patch
Size: 1287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160601/1b9dd969/attachment.bin>


More information about the llvm-commits mailing list