45 lines · plain
1# RUN: rm -rf %t && mkdir -p %t2# RUN: llvm-mc -triple=riscv32 -position-independent -filetype=obj \3# RUN: -o %t/elf_riscv32_got_plt_reloc.o %s4# RUN: llvm-jitlink -noexec \5# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \6# RUN: -abs external_func=0x1 -abs external_data=0x2 \7# RUN: -check %s %t/elf_riscv32_got_plt_reloc.o8 9 .text10 .file "testcase.c"11 12# Empty main entry point.13 .globl main14 .p2align 115 .type main,@function16main:17 ret18 19 .size main, .-main20# Test R_RISCV_GOT_HI20. The low 12 relocation is R_RISCV_PC_REL_LO12. This test case will21# check both the offset to the GOT entry and its content.22# jitlink-check: decode_operand(test_got, 1) = (got_addr(elf_riscv32_got_plt_reloc.o, external_data) - test_got + 0x800)[31:12]23# jitlink-check: decode_operand(test_got+4, 2)[11:0] = (got_addr(elf_riscv32_got_plt_reloc.o, external_data) - test_got)[11:0]24# jitlink-check: *{4}(got_addr(elf_riscv32_got_plt_reloc.o, external_data)) = external_data25 .globl test_got26 .p2align 127 .type test_got,@function28test_got:29 auipc a0, %got_pcrel_hi(external_data)30 lw a0, %pcrel_lo(test_got)(a0)31 32 .size test_got, .-test_got33 34# Test R_RISCV_CALL_PLT.35# jitlink-check: decode_operand(test_plt, 1) = (stub_addr(elf_riscv32_got_plt_reloc.o, external_func) - test_plt + 0x800)[31:12]36# jitlink-check: decode_operand(test_plt+4, 2) = (stub_addr(elf_riscv32_got_plt_reloc.o, external_func) - test_plt)[11:0]37# jitlink-check: *{4}(got_addr(elf_riscv32_got_plt_reloc.o, external_func)) = external_func38 .globl test_plt39 .p2align 140 .type test_got,@function41test_plt:42 call external_func@plt43 44 .size test_plt, .-test_plt45