[PATCH] D86777: [PowerPC] Fix missing TLS symbol type.
Stefan Pintilie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 04:58:39 PDT 2020
stefanp created this revision.
stefanp added reviewers: nemanjai, sfertile, NeHuang, MaskRay, hfinkel.
Herald added subscribers: shchenz, hiraditya.
Herald added a project: LLVM.
stefanp requested review of this revision.
Previous implementations for the TLS models General Dynamic and Initial Exec
were missing the ELF::STT_TLS type on symbols that required the type. This patch
adds the type.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86777
Files:
llvm/lib/MC/MCELFStreamer.cpp
llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
Index: llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
+++ llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
@@ -3,8 +3,9 @@
; RUN: FileCheck %s --check-prefix=CHECK-S
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj \
-; RUN: -enable-ppc-pcrel-tls < %s | llvm-objdump --mcpu=pwr10 -dr - | \
-; RUN: FileCheck %s --check-prefix=CHECK-O
+; RUN: -enable-ppc-pcrel-tls -o %t.o < %s
+; RUN: llvm-objdump --mcpu=pwr10 -dr %t.o | FileCheck %s --check-prefix=CHECK-O
+; RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM
; These test cases are to ensure that when using pc relative memory operations
; ABI correct code and relocations are produced for Initial Exec TLS Model.
@@ -42,6 +43,9 @@
; CHECK-O-NEXT: 2e 68 63 7c lwzx 3, 3, 13
; CHECK-O-NEXT: 0000000000000029: R_PPC64_TLS x
; CHECK-O-NEXT: 20 00 80 4e blr
+
+; CHECK-SYM-LABEL: Symbol table '.symtab' contains 6 entries
+; CHECK-SYM: 5: 0000000000000000 0 TLS GLOBAL DEFAULT UND x
entry:
%0 = load i32, i32* @x, align 4
ret i32 %0
Index: llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
+++ llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
@@ -3,8 +3,9 @@
; RUN: -enable-ppc-pcrel-tls < %s | FileCheck %s --check-prefix=CHECK-S
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN: --relocation-model=pic -mcpu=pwr10 -ppc-asm-full-reg-names \
-; RUN: -enable-ppc-pcrel-tls --filetype=obj < %s | \
-; RUN: llvm-objdump --mcpu=pwr10 -dr - | FileCheck %s --check-prefix=CHECK-O
+; RUN: -enable-ppc-pcrel-tls --filetype=obj -o %t.o < %s
+; RUN: llvm-objdump --mcpu=pwr10 -dr %t.o |FileCheck %s --check-prefix=CHECK-O
+; RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM
; These test cases are to ensure that when using pc relative memory operations
; ABI correct code and relocations are produced for General Dynamic TLS Model.
@@ -45,6 +46,9 @@
; CHECK-O-NEXT: 0000000000000054: R_PPC64_TLSGD x
; CHECK-O-NEXT: 0000000000000054: R_PPC64_REL24_NOTOC __tls_get_addr
; CHECK-O-NEXT: 58: 00 00 63 80 lwz 3, 0(3)
+
+ ; CHECK-SYM-LABEL: Symbol table '.symtab' contains 7 entries
+ ; CHECK-SYM: 6: 0000000000000000 0 TLS GLOBAL DEFAULT UND x
entry:
%0 = load i32, i32* @x, align 4
ret i32 %0
Index: llvm/lib/MC/MCELFStreamer.cpp
===================================================================
--- llvm/lib/MC/MCELFStreamer.cpp
+++ llvm/lib/MC/MCELFStreamer.cpp
@@ -438,11 +438,14 @@
case MCSymbolRefExpr::VK_PPC_GOT_DTPREL_HI:
case MCSymbolRefExpr::VK_PPC_GOT_DTPREL_HA:
case MCSymbolRefExpr::VK_PPC_TLS:
+ case MCSymbolRefExpr::VK_PPC_GOT_TPREL_PCREL:
+ case MCSymbolRefExpr::VK_PPC_TLS_PCREL:
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD:
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO:
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HI:
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA:
case MCSymbolRefExpr::VK_PPC_TLSGD:
+ case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_PCREL:
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD:
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO:
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HI:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86777.288582.patch
Type: text/x-patch
Size: 3580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200828/c2dda954/attachment.bin>
More information about the llvm-commits
mailing list