Skip to content

Commit e276216

Browse files
committed
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 9fc2909 from 2014 was confused.
1 parent c325712 commit e276216

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,10 @@ namespace {
204204
return InfosBE[Kind - FirstTargetFixupKind];
205205
}
206206

207-
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
208-
const MCValue &Target,
209-
const MCSubtargetInfo *STI) override {
210-
switch ((Sparc::Fixups)Fixup.getKind()) {
211-
default:
212-
return false;
213-
case Sparc::fixup_sparc_wplt30:
214-
if (Target.getAddSym()->isTemporary())
215-
return false;
216-
return true;
217-
}
207+
bool shouldForceRelocation(const MCAssembler &, const MCFixup &,
208+
const MCValue &,
209+
const MCSubtargetInfo *) override {
210+
return false;
218211
}
219212

220213
void relaxInstruction(MCInst &Inst,

llvm/test/MC/Sparc/sparc-pic.s

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
! RUN: llvm-mc %s -triple=sparcv9 -filetype=obj | llvm-readobj -r - | FileCheck --check-prefix=NOPIC %s
33

44

5-
! PIC: Relocations [
6-
! PIC-NOT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
7-
! PIC: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
5+
! PIC: .rela.text {
6+
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
87
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
98
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x0
109
! PIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x0
@@ -18,9 +17,8 @@
1817
! PIC: 0x{{[0-9,A-F]+}} R_SPARC_GOT13 value 0x0
1918
! PIC: ]
2019

21-
! NOPIC: Relocations [
22-
! NOPIC-NOT: 0x{{[0-9,A-F]+}} R_SPARC_WPLT30 .text 0xC
23-
! NOPIC: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x4
20+
! NOPIC: .rela.text {
21+
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x4
2422
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x8
2523
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x0
2624
! NOPIC-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x0

llvm/test/MC/Sparc/sparc-relocations.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_GOTDATA_OP sym
2424
! CHECK-OBJ-NEXT: }
2525

26+
call a
2627
! CHECK: call foo ! encoding: [0b01AAAAAA,A,A,A]
2728
call foo
2829

0 commit comments

Comments
 (0)