1 ## Check that llvm-bolt successfully relaxes branches for compact (<128MB) code
4 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
5 # RUN: link_fdata %s %t.o %t.fdata
6 # RUN: llvm-strip --strip-unneeded %t.o
7 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static
8 # RUN: llvm-bolt %t.exe -o %t.bolt --data %t.fdata --split-functions \
9 # RUN: --keep-nops --compact-code-model
10 # RUN: llvm-objdump -d \
11 # RUN: --disassemble-symbols=_start,_start.cold.0,foo,foo.cold.0 %t.bolt \
13 # RUN: llvm-nm -nS %t.bolt | FileCheck %s --check-prefix=CHECK-NM
15 ## Fragments of _start and foo will be separated by large_function which is over
16 ## 1MB in size - larger than all conditional branches can cover requiring branch
21 # CHECK-NM: 0000000000124f84 T large_function
22 # CHECK-NM: _start.cold.0
23 # CHECK-NM: foo.cold.0
27 .type _start, %function
30 # FDATA: 0 [unknown] 0 1 _start 0 0 100
42 .size _start, .-_start
44 ## Check that long branch in foo() is reused during relaxation. I.e. we should
45 ## see just one branch to the cold fragment.
51 # FDATA: 0 [unknown] 0 1 foo 0 0 100
56 # CHECK: b {{.*}} <foo.cold.0>
57 # CHECK-NOT: b {{.*}} <foo.cold.0>
58 # FDATA: 1 foo #.T0# 1 foo #.T1# 0 100
64 # FDATA: 1 foo #.T2# 1 foo #.T3# 0 100
70 # CHECK: <foo.cold.0>:
71 # CHECK-NEXT: mov x0, #0x1
80 .type large_function, %function
82 # FDATA: 0 [unknown] 0 1 large_function 0 0 100
89 .size large_function, .-large_function
91 ## Force relocation mode.
92 .reloc 0, R_AARCH64_NONE