[llvm] 24f8822 - [JITLink][AArch32] Add initial test for R_ARM_THM_CALL and R_ARM_THM_JUMP24
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 08:50:15 PDT 2023
Author: Stefan Gränitz
Date: 2023-09-06T17:49:51+02:00
New Revision: 24f882287666ea782bf84be9855c756755689561
URL: https://github.com/llvm/llvm-project/commit/24f882287666ea782bf84be9855c756755689561
DIFF: https://github.com/llvm/llvm-project/commit/24f882287666ea782bf84be9855c756755689561.diff
LOG: [JITLink][AArch32] Add initial test for R_ARM_THM_CALL and R_ARM_THM_JUMP24
This test still fails since RuntimeDyldChecker needs a few fixes before it works with Thumb. We can remove the XFAIL once the patch in D158280 landed.
Added:
llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
Modified:
Removed:
################################################################################
diff --git a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
new file mode 100644
index 000000000000000..76c5f5807f7b86c
--- /dev/null
+++ b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_static_thumb_reloc.s
@@ -0,0 +1,73 @@
+# RUN: llvm-mc -triple=thumbv7-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t.o %s
+# RUN: llvm-objdump -r %t.o | FileCheck --check-prefix=CHECK-TYPE %s
+# RUN: llvm-objdump --disassemble %t.o | FileCheck --check-prefix=CHECK-INSTR %s
+# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \
+# RUN: -slab-page-size 4096 -show-entry-es -check %s %t.o
+
+# This test requires the RuntimeDyldChecker fix from review D158280
+# XFAIL: *
+
+ .text
+ .syntax unified
+
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_CALL call_target
+# CHECK-INSTR: 00000000 <call_site>:
+# CHECK-INSTR: 0: f7ff fffe bl 0x0 <call_site>
+# CHECK-INSTR: 00000004 <call_target>:
+# CHECK-INSTR: 4: 4770 bx lr
+# We decode the operand with index 2, because bl generates two leading implicit
+# predicate operands that we have to skip in order to decode the call_target operand
+# jitlink-check: decode_operand(call_site, 2) = call_target - next_pc(call_site)
+ .globl call_site
+ .type call_site,%function
+ .p2align 1
+ .code 16
+ .thumb_func
+call_site:
+ bl call_target
+ .size call_site, .-call_site
+
+ .globl call_target
+ .type call_target,%function
+ .p2align 1
+ .code 16
+ .thumb_func
+call_target:
+ bx lr
+ .size call_target, .-call_target
+
+# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_JUMP24 jump24_target
+# CHECK-INSTR: 00000006 <jump24_site>:
+# CHECK-INSTR: 6: f7ff bffe b.w 0x6 <jump24_site>
+# CHECK-INSTR: 0000000a <jump24_target>:
+# CHECK-INSTR: a: 4770 bx lr
+# b.w generates two implicit predicate operands as well, but they are trailing
+# operands, so there is no need to adjust the operand index.
+# jitlink-check: decode_operand(jump24_site, 0) = jump24_target - next_pc(jump24_site)
+ .globl jump24_site
+ .type jump24_site,%function
+ .p2align 1
+ .code 16
+ .thumb_func
+jump24_site:
+ b.w jump24_target
+ .size jump24_site, .-jump24_site
+
+ .globl jump24_target
+ .type jump24_target,%function
+ .p2align 1
+ .code 16
+ .thumb_func
+jump24_target:
+ bx lr
+ .size jump24_target, .-jump24_target
+
+# Empty main function for jitlink to be happy
+ .globl main
+ .type main,%function
+ .p2align 1
+ .code 16
+ .thumb_func
+main:
+ bx lr
+ .size main, .-main
More information about the llvm-commits
mailing list