34 lines · plain
1# REQUIRES: riscv2 3# RUN: llvm-mc -filetype=obj -triple=riscv32-unknown-elf -mattr=-relax %s -o %t.rv32.o4# RUN: llvm-mc -filetype=obj -triple=riscv64-unknown-elf -mattr=-relax %s -o %t.rv64.o5 6# RUN: ld.lld %t.rv32.o --defsym foo=_start+8 --defsym bar=_start -o %t.rv327# RUN: ld.lld %t.rv64.o --defsym foo=_start+8 --defsym bar=_start -o %t.rv648# RUN: llvm-objdump -d %t.rv32 | FileCheck %s9# RUN: llvm-objdump -d %t.rv64 | FileCheck %s10# CHECK: 00000097 auipc ra, 0x011# CHECK-NEXT: 008080e7 jalr 0x8(ra)12# CHECK: 00000097 auipc ra, 0x013# CHECK-NEXT: ff8080e7 jalr -0x8(ra)14 15# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff7ff --defsym bar=_start+8-0x80000800 -o %t.rv32.limits16# RUN: ld.lld %t.rv64.o --defsym foo=_start+0x7ffff7ff --defsym bar=_start+8-0x80000800 -o %t.rv64.limits17# RUN: llvm-objdump -d %t.rv32.limits | FileCheck --check-prefix=LIMITS %s18# RUN: llvm-objdump -d %t.rv64.limits | FileCheck --check-prefix=LIMITS %s19# LIMITS: 7ffff097 auipc ra, 0x7ffff20# LIMITS-NEXT: 7ff080e7 jalr 0x7ff(ra)21# LIMITS-NEXT: 80000097 auipc ra, 0x8000022# LIMITS-NEXT: 800080e7 jalr -0x800(ra)23 24# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t25# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o /dev/null 2>&1 | \26# RUN: FileCheck --check-prefix=ERROR %s27# ERROR: relocation R_RISCV_CALL_PLT out of range: 524288 is not in [-524288, 524287]; references 'foo'28# ERROR: relocation R_RISCV_CALL_PLT out of range: -524289 is not in [-524288, 524287]; references 'bar'29 30.global _start31_start:32 call foo33 call bar34