[llvm] 34f8012 - [ARM] Improve STT_TLS tests and remove unsupported (tlsld) specifier

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 22:29:27 PDT 2025


Author: Fangrui Song
Date: 2025-03-21T22:29:22-07:00
New Revision: 34f80126e9cc11a82825dd503c28942145dce8c8

URL: https://github.com/llvm/llvm-project/commit/34f80126e9cc11a82825dd503c28942145dce8c8
DIFF: https://github.com/llvm/llvm-project/commit/34f80126e9cc11a82825dd503c28942145dce8c8.diff

LOG: [ARM] Improve STT_TLS tests and remove unsupported (tlsld) specifier

Test that symbols referenced through TLS-specific relocation specifiers
are set STT_TLS. As a minor issue, (tlsldo) does not set STT_TLS yet.

(tlsld) is not a valid specifier.

Added: 
    

Modified: 
    llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
    llvm/test/MC/ARM/symbol-variants.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
index 90fa70c5e7e4d..813826a5097ac 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
@@ -38,7 +38,6 @@ const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
     {MCSymbolRefExpr::VK_TLSDESC, "tlsdesc"},
     {MCSymbolRefExpr::VK_TLSGD, "TLSGD"},
     {MCSymbolRefExpr::VK_TLSGD_FDPIC, "tlsgd_fdpic"},
-    {MCSymbolRefExpr::VK_TLSLD, "TLSLD"},
     {MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"},
     {MCSymbolRefExpr::VK_TLSLDM_FDPIC, "tlsldm_fdpic"},
     {MCSymbolRefExpr::VK_TPOFF, "TPOFF"},

diff  --git a/llvm/test/MC/ARM/symbol-variants.s b/llvm/test/MC/ARM/symbol-variants.s
index 55ff9e37833f8..ea8f2ec47d403 100644
--- a/llvm/test/MC/ARM/symbol-variants.s
+++ b/llvm/test/MC/ARM/symbol-variants.s
@@ -1,4 +1,6 @@
-@ RUN: llvm-mc < %s -triple armv7-none-linux-gnueabi -filetype=obj  | llvm-objdump --triple=armv7-none-linux-gnueabi -r - | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
+@ RUN: llvm-mc %s -triple armv7-none-linux-gnueabi -filetype=obj -o %t
+@ RUN: llvm-objdump --triple=armv7-none-linux-gnueabi -r %t | FileCheck %s --check-prefixes=CHECK,ARM
+@ RUN: llvm-readelf -s - < %t | FileCheck %s --check-prefix=READELF --implicit-check-not=TLS
 @ RUN: llvm-mc < %s -triple thumbv7-none-linux-gnueabi -filetype=obj  | llvm-objdump --triple=thumbv7-none-linux-gnueabi -r - | FileCheck %s --check-prefix=CHECK --check-prefix=THUMB
 
 @ CHECK-LABEL: RELOCATION RECORDS FOR [.text]
@@ -41,12 +43,16 @@ bl f05(plt)
 .word f11(tpoff)
 @CHECK: 28 R_ARM_TLS_LE32 f10
 @CHECK: 2c R_ARM_TLS_LE32 f11
+ at READELF: TLS GLOBAL DEFAULT UND f10
+ at READELF: TLS GLOBAL DEFAULT UND f11
 
 @ tlsgd
 .word f12(TLSGD)
 .word f13(tlsgd)
 @CHECK: 30 R_ARM_TLS_GD32 f12
 @CHECK: 34 R_ARM_TLS_GD32 f13
+ at READELF: TLS GLOBAL DEFAULT UND f12
+ at READELF: TLS GLOBAL DEFAULT UND f13
 
 @ target1
 .word f14(TARGET1)
@@ -71,18 +77,24 @@ bl f05(plt)
 .word f21(tlsldo)
 @CHECK: 50 R_ARM_TLS_LDO32 f20
 @CHECK: 54 R_ARM_TLS_LDO32 f21
+ at READELF: NOTYPE GLOBAL DEFAULT UND f20
+ at READELF: NOTYPE GLOBAL DEFAULT UND f21
 
 @ tlscall
 .word f22(TLSCALL)
 .word f23(tlscall)
 @ CHECK: 58 R_ARM_TLS_CALL f22
 @ CHECK: 5c R_ARM_TLS_CALL f23
+ at READELF: TLS GLOBAL DEFAULT UND f22
+ at READELF: TLS GLOBAL DEFAULT UND f23
 
 @ tlsdesc
 .word f24(TLSDESC)
 .word f25(tlsdesc)
 @ CHECK: 60 R_ARM_TLS_GOTDESC f24
 @ CHECK: 64 R_ARM_TLS_GOTDESC f25
+ at READELF: TLS GLOBAL DEFAULT UND f24
+ at READELF: TLS GLOBAL DEFAULT UND f25
 
 @ prel31 (relative)
 .word f26(PREL31)-.
@@ -95,6 +107,8 @@ bl f05(plt)
 .word f29(tlsldm)
 @CHECK: 70 R_ARM_TLS_LDM32 f28
 @CHECK: 74 R_ARM_TLS_LDM32 f29
+ at READELF: TLS GLOBAL DEFAULT UND f28
+ at READELF: TLS GLOBAL DEFAULT UND f29
 
 @ relative
 .word f30 - (.Lsym+8)


        


More information about the llvm-commits mailing list