Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JITLink][RISCV] Add relocation fixup test
This patch add R_RISCV_HI20, R_RISCV_LO12 and R_RISCV_CALL relocation test Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D107327
- Loading branch information
luxufan
committed
Aug 6, 2021
1 parent
d6b4993
commit dc9b41f
Showing
2 changed files
with
48 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# RUN: rm -rf %t && mkdir -p %t | ||
# RUN: llvm-mc -triple=riscv64 -filetype=obj -o %t/elf_riscv64_non_pc_indirect_reloc.o %s | ||
# RUN: llvm-mc -triple=riscv32 -filetype=obj -o %t/elf_riscv32_non_pc_indirect_reloc.o %s | ||
# RUN: llvm-jitlink -noexec -slab-allocate 100Kb -slab-address 0xfff00000 -define-abs external_data=0xfff10000\ | ||
# RUN: -check %s %t/elf_riscv64_non_pc_indirect_reloc.o | ||
# RUN: llvm-jitlink -noexec -slab-allocate 100Kb -slab-address 0xfff00000 -define-abs external_data=0xfff10000\ | ||
# RUN: -check %s %t/elf_riscv32_non_pc_indirect_reloc.o | ||
# | ||
|
||
.text | ||
.file "testcase.c" | ||
|
||
# Empty main entry point. | ||
.globl main | ||
.p2align 1 | ||
.type main,@function | ||
main: | ||
ret | ||
|
||
.size main, .-main | ||
|
||
# Test R_RISCV_HI20 and R_RISCV_LO12 | ||
|
||
# jitlink-check: decode_operand(test_abs_rel, 1) = (external_data + 0x800)[31:12] | ||
# jitlink-check: decode_operand(test_abs_rel+4, 2)[11:0] = (external_data)[11:0] | ||
.globl test_abs_rel | ||
.p2align 1 | ||
.type test_abs_rel,@function | ||
test_abs_rel: | ||
lui a0, %hi(external_data) | ||
lw a0, %lo(external_data)(a0) | ||
|
||
.size test_abs_rel, .-test_abs_rel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters