From f07f96873aa8ffd848240e4add1d4c382f5aac29 Mon Sep 17 00:00:00 2001 From: ZhaoQi <zhaoqi01@loongson.cn> Date: Fri, 21 Mar 2025 16:05:45 +0800 Subject: [PATCH] Backport/20.x: [LoongArch] Fix the type of tls-le symbols (cherry picked from commit d6dc74e19f5cdb6995b13329480e330aff113f96) --- .../lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp | 1 + llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp index 30d2d0c1184ad..5698468c4754e 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp @@ -275,6 +275,7 @@ void LoongArchMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const { case VK_LoongArch_TLS_GD_HI20: case VK_LoongArch_TLS_DESC_PC_HI20: case VK_LoongArch_TLS_DESC_HI20: + case VK_LoongArch_TLS_LE_HI20_R: case VK_LoongArch_TLS_LD_PCREL20_S2: case VK_LoongArch_TLS_GD_PCREL20_S2: case VK_LoongArch_TLS_DESC_PCREL20_S2: diff --git a/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll b/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll index fe5f2195f0dc7..d39454a51a445 100644 --- a/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll +++ b/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll @@ -5,12 +5,12 @@ ; RUN: llvm-readelf -s %t-la64 | FileCheck %s --check-prefix=LA64 ; LA32: Symbol table '.symtab' contains [[#]] entries: -; LA32-NEXT: Num: Value Size Type Bind Vis Ndx Name -; LA32: 00000000 0 NOTYPE GLOBAL DEFAULT UND tls_sym +; LA32-NEXT: Num: Value Size Type Bind Vis Ndx Name +; LA32: 00000000 0 TLS GLOBAL DEFAULT UND tls_sym ; LA64: Symbol table '.symtab' contains [[#]] entries: -; LA64-NEXT: Num: Value Size Type Bind Vis Ndx Name -; LA64: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND tls_sym +; LA64-NEXT: Num: Value Size Type Bind Vis Ndx Name +; LA64: 0000000000000000 0 TLS GLOBAL DEFAULT UND tls_sym @tls_sym = external thread_local(localexec) global i32