[PATCH] D143115: [lld][RISCV] Introduce handling for R_RISCV_PLT32 relocation
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 2 09:52:26 PST 2023
MaskRay accepted this revision.
MaskRay added a comment.
Generally looks good, pending approval of the psABI proposal and test cleanup.
> This introduces R_RISCV_PLT32, a pc-relative relocation that takes the offset to a function (or its plt entry) from the reloc's location.
"PC-relative data relocation".
"32-bit relative offset to a function or its PLT entry".
================
Comment at: lld/test/ELF/riscv-reloc-plt32.s:1
+// RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=riscv64 %S/Inputs/abs256.s -o %t256.o
----------------
`#` is more common for RISC-V tests.
================
Comment at: lld/test/ELF/riscv-reloc-plt32.s:4
+
+// RUN: ld.lld -z max-page-size=4096 %t.o %t256.o -o %t2
+// RUN: llvm-objdump -s --section=.data %t2 | FileCheck %s
----------------
`-o %t`
In new tests, make the output name match the primary relocatable object file. If we ever need `%t2.o`, we can name its output file `%t2`.
================
Comment at: lld/test/ELF/riscv-undefined-weak.s:89
+.word target at plt - .
+# RELOC: 0xC R_RISCV_PLT32 target 0x0
----------------
Place the CHECK line above the instruction (the style used in this test file).
================
Comment at: llvm/test/MC/RISCV/elf-reloc-plt32.s:1
+// RUN: llvm-mc -triple=riscv64 -filetype=obj %s -o - | \
+// RUN: llvm-readobj -r - | FileCheck %s
----------------
`#`
================
Comment at: llvm/test/MC/RISCV/elf-reloc-plt32.s:8
+
+// CHECK: Section ({{.*}}) .rela.data
+// CHECK-NEXT: 0x0 R_RISCV_PLT32 extern_func 0x4
----------------
Add `{` to be clear it is paired with `}`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143115/new/
https://reviews.llvm.org/D143115
More information about the llvm-commits
mailing list