Skip to content

Commit 1391f04

Browse files
committed
Refactor test Assembly for simpler checking
1 parent 83590c4 commit 1391f04

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ class RuntimeDyldCheckerExprEval {
370370
? Checker.getSymbolLocalAddr(Symbol)
371371
: Checker.getSymbolRemoteAddr(Symbol);
372372

373-
// ARM mode adds an offset of 4 bytes to PC
373+
// ARM PC offset is 8 instead of 4, because it accounts for an additional
374+
// prefetch instruction that increments PC even though it is implicit.
374375
auto TT = Checker.getTripleForSymbol(Checker.getTargetFlag(Symbol));
375376
uint64_t PCOffset = TT.getArch() == Triple::ArchType::arm ? 4 : 0;
376377

llvm/test/ExecutionEngine/JITLink/AArch32/ELF_relocations_arm.s

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,29 @@
2323
.syntax unified
2424

2525
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_CALL call_target_arm
26-
# CHECK-INSTR: 00000000 <call_site>:
26+
# CHECK-INSTR: 00000000 <call_site_a2a>:
2727
# CHECK-INSTR: 0: ebfffffe bl
28-
# CHECK-INSTR: 4: ebfffffe bl
29-
# CHECK-INSTR: 0000000c <call_target_arm>
30-
# CHECK-INSTR: 00000010 <call_target_thumb>
31-
# jitlink-check: decode_operand(call_site + 0, 0) = call_target_arm - next_pc(call_site)
32-
# jitlink-check: decode_operand(call_site + 4, 0) = call_target_thumb - (call_site + 12)
33-
.globl call_site
34-
.type call_site,%function
28+
# CHECK-INSTR: 00000008 <call_site_a2t>:
29+
# CHECK-INSTR: 8: ebfffffe bl
30+
# CHECK-INSTR: 00000010 <call_target_arm>
31+
# CHECK-INSTR: 00000014 <call_target_thumb>
32+
# jitlink-check: decode_operand(call_site_a2a, 0) = call_target_arm - next_pc(call_site_a2a)
33+
# jitlink-check: decode_operand(call_site_a2t, 0) = call_target_thumb - next_pc(call_site_a2t)
34+
.globl call_site_a2a
35+
.type call_site_a2a, %function
3536
.p2align 2
36-
call_site:
37+
call_site_a2a:
3738
bl call_target_arm
39+
bx lr
40+
.size call_site_a2a, .-call_site_a2a
41+
42+
.globl call_site_a2t
43+
.type call_site_a2t,%function
44+
.p2align 2
45+
call_site_a2t:
3846
bl call_target_thumb
3947
bx lr
40-
.size call_site, .-call_site
48+
.size call_site_a2t, .-call_site_a2t
4149

4250
.globl call_target_arm
4351
.type call_target_arm,%function
@@ -57,9 +65,9 @@ call_target_thumb:
5765
.code 32
5866

5967
# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_JUMP24 jump24_target
60-
# CHECK-INSTR: 00000014 <jump24_site>:
61-
# CHECK-INSTR: 14: eafffffe b
62-
# CHECK-INSTR: 00000018 <jump24_target>
68+
# CHECK-INSTR: 00000018 <jump24_site>:
69+
# CHECK-INSTR: 18: eafffffe b
70+
# CHECK-INSTR: 0000001c <jump24_target>
6371
# jitlink-check: decode_operand(jump24_site, 0) = jump24_target - next_pc(jump24_site)
6472
.globl jump24_site
6573
.type jump24_site,%function

0 commit comments

Comments
 (0)