|
7 | 7 | ## (3) a second thunk is created when the first one goes out of range
|
8 | 8 | ## (4) early calls to a dylib stub use a thunk, and later calls the stub
|
9 | 9 | ## directly
|
| 10 | +## (5) Thunks are created for all sections in the text segment with branches. |
10 | 11 | ## Notes:
|
11 | 12 | ## 0x4000000 = 64 Mi = half the magnitude of the forward-branch range
|
12 | 13 |
|
13 | 14 | # RUN: rm -rf %t; mkdir %t
|
14 | 15 | # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t/input.o
|
15 |
| -# RUN: %lld -arch arm64 -dead_strip -lSystem -o %t/thunk %t/input.o |
| 16 | +# RUN: %lld -arch arm64 -dead_strip -lSystem -U _extern_sym -o %t/thunk %t/input.o |
16 | 17 | # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/thunk | FileCheck %s
|
17 | 18 |
|
18 | 19 | # CHECK: Disassembly of section __TEXT,__text:
|
|
164 | 165 | # CHECK: adrp x16, 0x[[#%x, F_PAGE]]
|
165 | 166 | # CHECK: add x16, x16, #[[#F_OFFSET]]
|
166 | 167 |
|
| 168 | +# CHECK: Disassembly of section __TEXT,__lcxx_override: |
| 169 | +# CHECK: <_z>: |
| 170 | +# CHECK: bl 0x[[#%x, A_THUNK_0]] <_a.thunk.0> |
| 171 | + |
167 | 172 | # CHECK: Disassembly of section __TEXT,__stubs:
|
168 | 173 |
|
169 | 174 | # CHECK: [[#%x, NAN_PAGE + NAN_OFFSET]] <__stubs>:
|
@@ -300,3 +305,17 @@ _main:
|
300 | 305 | bl _h
|
301 | 306 | bl ___nan
|
302 | 307 | ret
|
| 308 | + |
| 309 | +.section __TEXT,__cstring |
| 310 | + .space 0x4000000 |
| 311 | + |
| 312 | +.section __TEXT,__lcxx_override,regular,pure_instructions |
| 313 | + |
| 314 | +.globl _z |
| 315 | +.no_dead_strip _z |
| 316 | +.p2align 2 |
| 317 | +_z: |
| 318 | + bl _a |
| 319 | + ## Ensure calling into stubs works |
| 320 | + bl _extern_sym |
| 321 | + ret |
0 commit comments