Skip to content

Commit bb6fbcc

Browse files
committed
[Tests][RuntimeDyld] Make sure we use a stub for cross-section branches.
We mustn't use direct branches for cross-section branches, because doing so will result in problems if the sections aren't loaded at the same offsets in the target process as in the host process. rdar://127673408
1 parent 73f36fe commit bb6fbcc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %t %s
2+
# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -check=%s %t
3+
4+
.globl _main
5+
.weak _label1
6+
7+
.section .text.label1,"ax"
8+
_label1:
9+
nop
10+
11+
.section .text.main,"ax"
12+
_main:
13+
b _label1
14+
15+
# Branch must be to stub in .text.main, *not* back to _label1, because
16+
# in general sections could be loaded at arbitrary addresses in target memory,
17+
# and when initially processing locations and generating stubs we don't know
18+
# the final layout yet, so we can't tell if the branch offset is within range.
19+
20+
# rtdyld-check: *{4}(_main) = 0x14000001

0 commit comments

Comments
 (0)