[PATCH] D134715: [LoongArch] Produce a R_LARCH_32_PCREL relocation

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 18:05:06 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG036b170c24f7: [LoongArch] Produce a R_LARCH_32_PCREL relocation (authored by wangleiat, committed by SixWeining).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134715/new/

https://reviews.llvm.org/D134715

Files:
  llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
  llvm/test/MC/LoongArch/Relocations/fde-reloc.s


Index: llvm/test/MC/LoongArch/Relocations/fde-reloc.s
===================================================================
--- /dev/null
+++ llvm/test/MC/LoongArch/Relocations/fde-reloc.s
@@ -0,0 +1,14 @@
+# RUN: llvm-mc --filetype=obj --triple=loongarch64 < %s \
+# RUN:     | llvm-readobj -r - | FileCheck %s
+
+## Ensure that the eh_frame records the symbolic difference with
+## the R_LARCH_32_PCREL relocation.
+
+func:
+ .cfi_startproc
+  ret
+ .cfi_endproc
+
+# CHECK:   Section (4) .rela.eh_frame {
+# CHECK-NEXT:   0x1C R_LARCH_32_PCREL - 0x0
+# CHECK-NEXT: }
Index: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
===================================================================
--- llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
+++ llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
@@ -64,7 +64,7 @@
     Ctx.reportError(Fixup.getLoc(), "2-byte data relocations not supported");
     return ELF::R_LARCH_NONE;
   case FK_Data_4:
-    return ELF::R_LARCH_32;
+    return IsPCRel ? ELF::R_LARCH_32_PCREL : ELF::R_LARCH_32;
   case FK_Data_8:
     return ELF::R_LARCH_64;
   case LoongArch::fixup_loongarch_b16:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134715.463732.patch
Type: text/x-patch
Size: 1182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220929/b26e9bfb/attachment.bin>


More information about the llvm-commits mailing list