brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 5fa195f Raw
84 lines · plain
1# REQUIRES: aarch642 3# foo.s and bar.s both contain TU-local symbols (think static function)4# with the same name, and both need a thunk.  This tests that ld64.lld doesn't5# create a duplicate symbol for the two functions.6 7# Test this both when the TU-local symbol is the branch source or target,8# and for both forward and backwards jumps.9 10# RUN: rm -rf %t; split-file %s %t11# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/foo.s -o %t/foo.o12# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/bar.s -o %t/bar.o13# RUN: %lld -arch arm64 -lSystem -o %t.out %t/foo.o %t/bar.o14 15#--- foo.s16 17.subsections_via_symbols18 19# Note: No .globl, since these are TU-local symbols.20.p2align 221_early_jumping_local_fn: b _some_late_external22.p2align 223_early_landing_local_fn: ret24 25.globl _some_early_external26.p2align 227_some_early_external: b _late_landing_local_fn28 29## 0x8000000 is 128 MiB, one more than the forward branch limit.30## Distribute that over two functions since our thunk insertion algorithm31## can't deal with a single function that's 128 MiB.32.global _spacer1, _spacer233_spacer1:34.space 0x400000035_spacer2:36.space 0x400000037 38# Note: No .globl, since these are TU-local symbols.39.p2align 240_late_jumping_local_fn: b _some_early_external41.p2align 242_late_landing_local_fn: ret43 44.globl _some_late_external45.p2align 246_some_late_external: b _early_landing_local_fn47 48#--- bar.s49 50.subsections_via_symbols51 52# Note: No .globl, since these are TU-local symbols.53.p2align 254_early_jumping_local_fn: b _some_other_late_external55.p2align 256_early_landing_local_fn: ret57 58.globl _some_other_early_external59.p2align 260_some_other_early_external: b _late_landing_local_fn61 62## 0x8000000 is 128 MiB, one more than the forward branch limit.63## Distribute that over two functions since our thunk insertion algorithm64## can't deal with a single function that's 128 MiB.65.global _other_spacer1, _other_spacer166_spacer1:67.space 0x400000068_spacer2:69.space 0x400000070 71# Note: No .globl, since these are TU-local symbols.72.p2align 273_late_jumping_local_fn: b _some_other_early_external74.p2align 275_late_landing_local_fn: ret76 77.globl _some_other_late_external78.p2align 279_some_other_late_external: b _early_landing_local_fn80 81.globl _main82_main:83  ret84