[lld] [LLD][RISCV] Error on PCREL_LO referencing other Section (PR #107558)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 23:06:25 PDT 2024
================
@@ -0,0 +1,35 @@
+# REQUIRES: riscv
+
+# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
+# RUN: not ld.lld %t.o 2>&1 | FileCheck %s
+
+# CHECK: error: {{.*}}:(.text.sec_one+0x0): R_RISCV_PCREL_LO12 relocation points to a symbol '.Lpcrel_hi0' in a different section '.text.sec_two'
+# CHECK: error: {{.*}}:(.text.sec_one+0x4): R_RISCV_PCREL_LO12 relocation points to a symbol '.Lpcrel_hi1' in a different section '.text.sec_two'
+# CHECK-NOT: R_RISCV_PCREL_LO12 relocation points to a symbol '.Lpcrel_hi2'
+
+## This test is checking that we warn the user when the relocations in their
+## object don't follow the RISC-V psABI. In particular, the psABI requires
+## that PCREL_LO12 relocations are in the same section as the pcrel_hi
+## instruction they point to.
+
+ .section .text.sec_one,"ax"
+ .globl sec_one
+sec_one:
----------------
MaskRay wrote:
Delete unused symbols `sec_one` `sec_two`
https://github.com/llvm/llvm-project/pull/107558
More information about the llvm-commits
mailing list