[llvm] 6922eed - [CSKY] Add missing relocation type for FK_Data_4 Fixup

Zi Xuan Wu via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 23:59:29 PDT 2023


Author: Zi Xuan Wu (Zeson)
Date: 2023-05-26T14:54:53+08:00
New Revision: 6922eedd46a991766ba8d568183250b94b1842b3

URL: https://github.com/llvm/llvm-project/commit/6922eedd46a991766ba8d568183250b94b1842b3
DIFF: https://github.com/llvm/llvm-project/commit/6922eedd46a991766ba8d568183250b94b1842b3.diff

LOG: [CSKY] Add missing relocation type for FK_Data_4 Fixup

Added: 
    

Modified: 
    llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
    llvm/test/MC/CSKY/const-pool.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
index d7cc4c8525ee2..2548c83770ffb 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYELFObjectWriter.cpp
@@ -117,6 +117,12 @@ unsigned CSKYELFObjectWriter::getRelocType(MCContext &Ctx,
         return ELF::R_CKCORE_GOTOFF;
       case MCSymbolRefExpr::VK_PLT:
         return ELF::R_CKCORE_PLT32;
+      case MCSymbolRefExpr::VK_TLSGD:
+        return ELF::R_CKCORE_TLS_GD32;
+      case MCSymbolRefExpr::VK_TLSLDM:
+        return ELF::R_CKCORE_TLS_LDM32;
+      case MCSymbolRefExpr::VK_TPOFF:
+        return ELF::R_CKCORE_TLS_LE32;
       case MCSymbolRefExpr::VK_None:
         return ELF::R_CKCORE_ADDR32;
       }

diff  --git a/llvm/test/MC/CSKY/const-pool.s b/llvm/test/MC/CSKY/const-pool.s
index 3225a9137e55d..cf2d879b373dc 100644
--- a/llvm/test/MC/CSKY/const-pool.s
+++ b/llvm/test/MC/CSKY/const-pool.s
@@ -16,3 +16,19 @@ lrw a3, [.LCPI1_2]
 # CHECK:        0:      	lrw16	r3, 0x3ec
 # CHECK:      3f0:              lrw32	r3, 0x7e0
 
+# CHECK: 000007e0:  R_CKCORE_GOTOFF	symA
+# CHECK: 000007e4:  R_CKCORE_GOT32	va1
+# CHECK: 000007e8:  R_CKCORE_GOTOFF	va2
+# CHECK: 000007ec:  R_CKCORE_PLT32	va3
+# CHECK: 000007f0:  R_CKCORE_TLS_GD32	va4
+# CHECK: 000007f4:  R_CKCORE_TLS_LDM32	va5
+# CHECK: 000007f8:  R_CKCORE_TLS_LE32	va6
+
+
+.LCPI0_0:
+    .long   va1 at GOT
+    .long   va2 at GOTOFF
+    .long   va3 at PLT
+    .long   va4 at TLSGD
+    .long   va5 at TLSLDM
+    .long   va6 at TPOFF


        


More information about the llvm-commits mailing list