[llvm] e276216 - Sparc: Remove incorrect STT_SECTION adjustment special case for WPLT30
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat May 3 19:08:02 PDT 2025
Author: Fangrui Song
Date: 2025-05-03T19:07:57-07:00
New Revision: e276216221b09b296a65c1a6d09e1ae641edcc8e
URL: https://github.com/llvm/llvm-project/commit/e276216221b09b296a65c1a6d09e1ae641edcc8e
DIFF: https://github.com/llvm/llvm-project/commit/e276216221b09b296a65c1a6d09e1ae641edcc8e.diff
LOG: Sparc: Remove incorrect STT_SECTION adjustment special case for WPLT30
`call local` should perform STT_SECTION adjustment as well as `call .Ltmp0`.
The early support 9fc29098dfa684de53dd180aa93e94c39c388631 from 2014 was
confused.
Added:
Modified:
llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
llvm/test/MC/Sparc/sparc-pic.s
llvm/test/MC/Sparc/sparc-relocations.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
index 2397c62c73ef0..6386f6786df3c 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
@@ -204,17 +204,10 @@ namespace {
return InfosBE[Kind - FirstTargetFixupKind];
}
- bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
- const MCValue &Target,
- const MCSubtargetInfo *STI) override {
- switch ((Sparc::Fixups)Fixup.getKind()) {
- default:
- return false;
- case Sparc::fixup_sparc_wplt30:
- if (Target.getAddSym()->isTemporary())
- return false;
- return true;
- }
+ bool shouldForceRelocation(const MCAssembler &, const MCFixup &,
+ const MCValue &,
+ const MCSubtargetInfo *) override {
+ return false;
}
void relaxInstruction(MCInst &Inst,
diff --git a/llvm/test/MC/Sparc/sparc-pic.s b/llvm/test/MC/Sparc/sparc-pic.s
index 6cfd6642c70b8..49aadd0a764d4 100644
--- a/llvm/test/MC/Sparc/sparc-pic.s
+++ b/llvm/test/MC/Sparc/sparc-pic.s
@@ -2,9 +2,8 @@
! RUN: llvm-mc %s -triple=sparcv9 -filetype=obj | llvm-readobj -r - | FileCheck --check-prefix=NOPIC %s
-! PIC: Relocations [
-! PIC-NOT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
-! PIC: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
+! PIC: .rela.text {
+! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x0
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x0
@@ -18,9 +17,8 @@
! PIC: 0x{{[0-9,A-F]+}} R_SPARC_GOT13 value 0x0
! PIC: ]
-! NOPIC: Relocations [
-! NOPIC-NOT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
-! NOPIC: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x4
+! NOPIC: .rela.text {
+! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x4
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x8
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x0
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x0
diff --git a/llvm/test/MC/Sparc/sparc-relocations.s b/llvm/test/MC/Sparc/sparc-relocations.s
index 027164d77b256..62088338cb363 100644
--- a/llvm/test/MC/Sparc/sparc-relocations.s
+++ b/llvm/test/MC/Sparc/sparc-relocations.s
@@ -23,6 +23,7 @@
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOTDATA_OP sym
! CHECK-OBJ-NEXT: }
+ call a
! CHECK: call foo ! encoding: [0b01AAAAAA,A,A,A]
call foo
More information about the llvm-commits
mailing list