22## non-optimized code.
33
44# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
5+ # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
6+ # RUN: --defsym COMPACT=1 %s -o %t.compact.o
57# RUN: link_fdata %s %t.o %t.fdata
6- # RUN: llvm-strip --strip-unneeded %t.o
8+ # RUN: llvm-strip --strip-unneeded %t* .o
79# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static
10+ # RUN: %clang %cflags %t.compact.o -o %t.compact.exe -Wl,-q -static
811# RUN: llvm-bolt %t.exe -o %t.bolt --data %t.fdata --lite
12+ # RUN: llvm-bolt %t.compact.exe -o %t.compact.bolt --data %t.fdata --lite \
13+ # RUN: --compact-code-model
914# RUN: llvm-objdump -d --disassemble-symbols=cold_function %t.exe \
1015# RUN: | FileCheck %s --check-prefix=CHECK-INPUT
1116# RUN: llvm-objdump -d --disassemble-symbols=cold_function %t.bolt \
1217# RUN: | FileCheck %s
1318# RUN: llvm-objdump -d --disassemble-symbols=_start.org.0 %t.bolt \
1419# RUN: | FileCheck %s --check-prefix=CHECK-PATCH
20+ # RUN: llvm-objdump -d %t.compact.bolt \
21+ # RUN: | FileCheck %s --check-prefix=CHECK-COMPACT
1522
23+ ## In compact mode, make sure we do not create an unnecessary patch thunk.
24+ # CHECK-COMPACT-NOT: <_start.org.0>
1625
1726## Verify that the number of FDEs matches the number of functions in the output
1827## binary. There are three original functions and two optimized.
@@ -33,7 +42,8 @@ _start:
3342# FDATA: 0 [unknown] 0 1 _start 0 0 100
3443 .cfi_startproc
3544
36- ## Check that the code at the orignal location is converted into a veneer/thunk.
45+ ## Check that the code at the original location is converted into a
46+ ## veneer/thunk.
3747# CHECK-PATCH-LABEL: <_start.org.0>
3848# CHECK-PATCH-NEXT: adrp x16
3949# CHECK-PATCH-NEXT: add x16, x16,
@@ -122,9 +132,11 @@ cold_function:
122132 .cfi_endproc
123133 .size cold_function, .-cold_function
124134
135+ .ifndef COMPACT
125136## Reserve 128MB of space to make functions that follow unreachable by ADRs in
126137## code that precedes this gap.
127138.space 0x8000000
139+ .endif
128140
129141 .globl far_func
130142 .type far_func, %function
0 commit comments