[llvm] 912579f - [CSKY, test] Test section symbol and STT_TLS adjustment

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 22 21:21:09 PDT 2025


Author: Fangrui Song
Date: 2025-03-22T21:21:02-07:00
New Revision: 912579f428bd3d3d42cdb39155de911524065eeb

URL: https://github.com/llvm/llvm-project/commit/912579f428bd3d3d42cdb39155de911524065eeb
DIFF: https://github.com/llvm/llvm-project/commit/912579f428bd3d3d42cdb39155de911524065eeb.diff

LOG: [CSKY,test] Test section symbol and STT_TLS adjustment

Added: 
    

Modified: 
    llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
    llvm/test/MC/CSKY/relocation-specifier.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
index 48eab15a68d94..4471c1cc05d99 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
@@ -39,18 +39,6 @@ unsigned CSKYELFObjectWriter::getRelocType(MCContext &Ctx,
   // Determine the type of the relocation
   unsigned Kind = Fixup.getTargetKind();
   uint8_t Modifier = Target.getAccessVariant();
-  switch (Modifier) {
-  case CSKYMCExpr::VK_TLSGD:
-  case CSKYMCExpr::VK_TLSLDM:
-  case CSKYMCExpr::VK_TLSLDO:
-  case CSKYMCExpr::VK_TLSIE:
-  case CSKYMCExpr::VK_TLSLE:
-    if (auto *S = Target.getSymA())
-      cast<MCSymbolELF>(S->getSymbol()).setType(ELF::STT_TLS);
-    break;
-  default:
-    break;
-  }
 
   if (IsPCRel) {
     switch (Kind) {

diff  --git a/llvm/test/MC/CSKY/relocation-specifier.s b/llvm/test/MC/CSKY/relocation-specifier.s
index 51b40376cb2a0..e46f9b6912220 100644
--- a/llvm/test/MC/CSKY/relocation-specifier.s
+++ b/llvm/test/MC/CSKY/relocation-specifier.s
@@ -1,10 +1,14 @@
 # RUN: llvm-mc -filetype=obj -triple=csky -mattr=+2e3 %s -o %t
-# RUN: llvm-readelf -s - < %t | FileCheck %s --check-prefix=READELF --implicit-check-not=TLS
+# RUN: llvm-readelf -rs %t | FileCheck %s --check-prefix=READELF
 
-# READELF: TLS GLOBAL DEFAULT UND gd
-# READELF: TLS GLOBAL DEFAULT UND ld
-# READELF: TLS GLOBAL DEFAULT UND ie
-# READELF: TLS GLOBAL DEFAULT UND le
+# READELF: '.rela.data'
+# READELF: R_CKCORE_GOT32 00000000 .data + 0
+# READELF: R_CKCORE_PLT32 00000000 .data + 0
+
+# READELF: NOTYPE GLOBAL DEFAULT UND gd
+# READELF: NOTYPE GLOBAL DEFAULT UND ld
+# READELF: NOTYPE GLOBAL DEFAULT UND ie
+# READELF: NOTYPE GLOBAL DEFAULT UND le
 
 lrw16 r0, gd at TLSGD32
 lrw16 r0, ld at TLSLDM32
@@ -12,4 +16,6 @@ lrw16 r3, ie at GOTTPOFF
 lrw16 r3, le at TPOFF
 
 .data
-.long got at GOT
+local:
+.long local at GOT
+.long local at plt


        


More information about the llvm-commits mailing list