[PATCH] D142453: [AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_frame) sections
Juan Manuel Martinez CaamaƱo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 27 09:34:32 PST 2023
jmmartinez created this revision.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
jmmartinez published this revision for review.
jmmartinez added reviewers: kzhuravl, scott.linder.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142453
Files:
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/test/MC/AMDGPU/cfi_reloc.s
Index: llvm/test/MC/AMDGPU/cfi_reloc.s
===================================================================
--- /dev/null
+++ llvm/test/MC/AMDGPU/cfi_reloc.s
@@ -0,0 +1,16 @@
+// RUN: llvm-mc -filetype=obj -triple amdgcn-- -mcpu=kaveri -show-encoding %s | llvm-readobj -r - | FileCheck %s
+
+// CHECK: Relocations [
+// CHECK: .rel.eh_frame {
+// CHECK: R_AMDGPU_REL32 .text
+// CHECK: }
+// CHECK: .rel.debug_frame {
+// CHECK: R_AMDGPU_ABS64 .text
+// CHECK: }
+// CHECK: ]
+
+kernel:
+ .cfi_startproc
+ .cfi_sections .debug_frame, .eh_frame
+ s_endpgm
+ .cfi_endproc
\ No newline at end of file
Index: llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
+++ llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
@@ -74,9 +74,9 @@
return ELF::R_AMDGPU_REL32;
case FK_Data_4:
case FK_SecRel_4:
- return ELF::R_AMDGPU_ABS32;
+ return IsPCRel ? ELF::R_AMDGPU_REL32 : ELF::R_AMDGPU_ABS32;
case FK_Data_8:
- return ELF::R_AMDGPU_ABS64;
+ return IsPCRel ? ELF::R_AMDGPU_REL64 : ELF::R_AMDGPU_ABS64;
}
if (Fixup.getTargetKind() == AMDGPU::fixup_si_sopp_br) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142453.491704.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230127/70697249/attachment.bin>
More information about the llvm-commits
mailing list