Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / AArch64 / veneer-gold.s
blob3b3e34ecb1a9f5be90d2a9b8cc5e696aa57d5d21
1 // This test checks that the gold linker style veneer are properly handled
2 // by BOLT.
3 // Strip .rela.mytext section to simulate inserted by a linker veneers
4 // that does not contain relocations.
6 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
7 # RUN: %s -o %t.o
8 # RUN: %clang %cflags -fPIC -pie %t.o -o %t.exe -nostdlib \
9 # RUN: -fuse-ld=lld -Wl,--no-relax -Wl,-q
10 # RUN: llvm-objcopy --remove-section .rela.mytext %t.exe
11 # RUN: llvm-objdump -d -j .mytext %t.exe | \
12 # RUN: FileCheck --check-prefix=CHECKVENEER %s
13 # RUN: llvm-bolt %t.exe -o %t.bolt --elim-link-veneers=true \
14 # RUN: --lite=0 --use-old-text=0
15 # RUN: llvm-objdump -d -j .text %t.bolt | FileCheck %s
17 .text
18 .balign 4
19 .global dummy
20 .type dummy, %function
21 dummy:
22 adrp x1, dummy
23 ret
24 .size dummy, .-dummy
26 .section ".mytext", "ax"
27 .balign 4
28 .global foo
29 .type foo, %function
30 foo:
31 # CHECK: <foo>:
32 # CHECK-NEXT : {{.*}} bl {{.*}} <foo2>
33 bl .L2
34 ret
35 .size foo, .-foo
37 .global foo2
38 .type foo2, %function
39 foo2:
40 # CHECK: <foo2>:
41 # CHECK-NEXT : {{.*}} bl {{.*}} <foo2>
42 bl .L2
43 ret
44 .size foo2, .-foo2
46 .global _start
47 .type _start, %function
48 _start:
49 # CHECK: <_start>:
50 # CHECK-NEXT: {{.*}} bl {{.*}} <foo>
51 bl .L1
52 adr x0, .L0
53 ret
54 .L0:
55 .xword 0
56 .size _start, .-_start
57 .L1:
58 # CHECKVENEER: adrp
59 # CHECKVENEER-NEXT: add
60 # CHECKVENEER-NEXT: br
61 # CHECKVENEER-NEXT: nop
62 adrp x16, foo
63 add x16, x16, #:lo12:foo
64 br x16
65 nop
66 .L2:
67 # CHECKVENEER-NEXT: adrp
68 # CHECKVENEER-NEXT: add
69 # CHECKVENEER-NEXT: br
70 # CHECKVENEER-NEXT: nop
71 adrp x16, foo2
72 add x16, x16, #:lo12:foo2
73 br x16
74 nop