brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · ebdefd3 Raw
33 lines · plain
1# REQUIRES: riscv2 3# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o4# RUN: not ld.lld %t.o 2>&1 | FileCheck %s5 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'9 10## This test is checking that we warn the user when the relocations in their11## object don't follow the RISC-V psABI. In particular, the psABI requires12## that PCREL_LO12 relocations are in the same section as the pcrel_hi13## instruction they point to.14 15  .section .text.sec_one,"ax"16  addi a0, a0, %pcrel_lo(.Lpcrel_hi0)17  sw a0, %pcrel_lo(.Lpcrel_hi1)(a1)18 19  .section .text.sec_two,"ax"20.Lpcrel_hi0:21  auipc a0, %pcrel_hi(a)22.Lpcrel_hi1:23  auipc a1, %pcrel_hi(a)24 25.Lpcrel_hi2:26  auipc a2, %pcrel_hi(a)27  addi a2, a2, %pcrel_lo(.Lpcrel_hi2)28 29  .data30  .global a31a:32  .word 5033