Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / AArch64 / veneer.s
blobd3648ed2afa867dfa4aca8ff74888bea0c19988e
1 // This test checks that the veneer are properly handled by BOLT.
2 // Strip .rela.mytext section to simulate inserted by a linker veneers
3 // that does not contain relocations.
5 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
6 # RUN: %s -o %t.o
7 # RUN: %clang %cflags -fPIC -pie %t.o -o %t.exe -nostdlib \
8 # RUN: -fuse-ld=lld -Wl,--no-relax -Wl,-q
9 # RUN: llvm-objdump -d --disassemble-symbols='myveneer' %t.exe | \
10 # RUN: FileCheck --check-prefix=CHECKVENEER %s
11 # RUN: llvm-objcopy --remove-section .rela.mytext %t.exe
12 # RUN: llvm-bolt %t.exe -o %t.bolt --elim-link-veneers=true --lite=0
13 # RUN: llvm-objdump -d -j .text --disassemble-symbols='myveneer' %t.bolt | \
14 # RUN: FileCheck --check-prefix=CHECKOUTVENEER %s
15 # RUN: llvm-objdump -d --disassemble-symbols='_start' %t.bolt | FileCheck %s
17 .text
18 .balign 4
19 .global foo
20 .type foo, %function
21 foo:
22 adrp x1, foo
23 ret
24 .size foo, .-foo
26 .section ".mytext", "ax"
27 .balign 4
28 # CHECKOUTVENEER-NOT: {{.*}} <myveneer>:
29 .global myveneer
30 .type myveneer, %function
31 myveneer:
32 # CHECKVENEER: adrp
33 # CHECKVENEER-NEXT: add
34 adrp x16, foo
35 add x16, x16, #:lo12:foo
36 br x16
37 nop
38 .size myveneer, .-myveneer
40 .global _start
41 .type _start, %function
42 _start:
43 # CHECK: {{.*}} bl {{.*}} <foo>
44 bl myveneer
45 ret
46 .size _start, .-_start