3 # RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
4 # RUN: not ld.lld %t.o 2>&1 | FileCheck %s
6 # CHECK: error: {{.*}}:(.text.sec_one+0x0): R_RISCV_PCREL_LO12 relocation points to a symbol '.Lpcrel_hi0' in a different section '.text.sec_two'
7 # CHECK: error: {{.*}}:(.text.sec_one+0x4): R_RISCV_PCREL_LO12 relocation points to a symbol '.Lpcrel_hi1' in a different section '.text.sec_two'
8 # CHECK-NOT: R_RISCV_PCREL_LO12 relocation points to a symbol '.Lpcrel_hi2'
10 ## This test is checking that we warn the user when the relocations in their
11 ## object don't follow the RISC-V psABI. In particular, the psABI requires
12 ## that PCREL_LO12 relocations are in the same section as the pcrel_hi
13 ## instruction they point to.
15 .section .text.sec_one,"ax"
16 addi a0
, a0
, %pcrel_lo
(.Lpcrel_hi0)
17 sw a0
, %pcrel_lo
(.Lpcrel_hi1)(a1)
19 .section .text.sec_two,"ax"
21 auipc a0
, %pcrel_hi
(a)
23 auipc a1
, %pcrel_hi
(a)
26 auipc a2
, %pcrel_hi
(a)
27 addi a2
, a2
, %pcrel_lo
(.Lpcrel_hi2)