2 # RUN: rm -rf %t; split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/foo.s -o %t/foo.o
4 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/bar.s -o %t/bar.o
5 # RUN: %lld -dylib -arch arm64 -lSystem -o %t/out %t/foo.o %t/bar.o
7 # RUN: llvm-objdump --macho --syms %t/out | FileCheck %s
10 ## Regression test for PR59259. Previously, we neglected to check section
11 ## alignments when deciding when to create thunks.
13 ## If we ignore alignment, the total size of _spacer1 + _spacer2 below is just
14 ## under the limit at which we attempt to insert thunks between the spacers.
15 ## However, with alignment accounted for, their total size ends up being
16 ## 0x8000000, which is just above the max forward branch range, making thunk
17 ## insertion necessary. Thus, not accounting for alignment led to an error.
24 ## Size of a `b` instruction.
26 ## Refer to `slop` in TextOutputSection::finalize().
27 .equ slopSize, 12 * 256
30 .space 0x4000000 - slopSize - 2 * callSize - 1
32 .subsections_via_symbols
44 .subsections_via_symbols