Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / orc_unwind.s
blob4f8b9332dfef1cc031516a178cf9ce35f9790dd7
1 # REQUIRES: system-linux
3 ## Check that BOLT correctly reads ORC unwind information used by Linux Kernel.
5 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
6 # RUN: %clang %cflags %t.o -o %t.exe
8 # RUN: llvm-bolt %t.exe --print-normalized --dump-orc --print-orc -o %t.out \
9 # RUN: |& FileCheck %s
11 # CHECK: BOLT-INFO: ORC unwind information:
12 # CHECK-NEXT: {sp: 8, bp: 0, info: 0x5}: _start
13 # CHECK-NEXT: {sp: 0, bp: 0, info: 0x0}: _start
14 # CHECK-NEXT: {sp: 8, bp: 0, info: 0x5}: foo
15 # CHECK-NEXT: {sp: 16, bp: -16, info: 0x15}: foo
16 # CHECK-NEXT: {sp: 16, bp: -16, info: 0x14}: foo
17 # CHECK-NEXT: {sp: 8, bp: 0, info: 0x5}: foo
18 # CHECK-NEXT: {sp: 0, bp: 0, info: 0x0}: bar
20 .text
21 .globl _start
22 .type _start, %function
23 _start:
24 .cfi_startproc
26 call foo
27 # CHECK: callq foo # ORC: {sp: 8, bp: 0, info: 0x5}
28 ret
29 .cfi_endproc
30 .size _start, .-_start
32 .globl foo
33 .type foo, %function
34 foo:
35 .cfi_startproc
36 push %rbp
37 # CHECK: pushq %rbp # ORC: {sp: 8, bp: 0, info: 0x5}
38 .L1:
39 mov %rsp, %rbp
40 # CHECK: movq %rsp, %rbp # ORC: {sp: 16, bp: -16, info: 0x15}
41 .L2:
42 pop %rbp
43 # CHECK: popq %rbp # ORC: {sp: 16, bp: -16, info: 0x14}
44 .L3:
45 ret
46 # CHECK: retq # ORC: {sp: 8, bp: 0, info: 0x5}
47 .cfi_endproc
48 .size foo, .-foo
50 bar:
51 .cfi_startproc
52 ret
53 # Same ORC info propagated from foo above.
54 # CHECK: retq # ORC: {sp: 8, bp: 0, info: 0x5}
55 .L4:
56 .cfi_endproc
57 .size bar, .-bar
59 .section .orc_unwind,"a",@progbits
60 .align 4
61 .section .orc_unwind_ip,"a",@progbits
62 .align 4
64 # ORC for _start
65 .section .orc_unwind
66 .2byte 8
67 .2byte 0
68 .2byte 5
69 .section .orc_unwind_ip
70 .long _start - .
72 .section .orc_unwind
73 .2byte 0
74 .2byte 0
75 .2byte 0
76 .section .orc_unwind_ip
77 .long foo - .
79 # ORC for foo
80 .section .orc_unwind
81 .2byte 8
82 .2byte 0
83 .2byte 5
84 .section .orc_unwind_ip
85 .long foo - .
87 .section .orc_unwind
88 .2byte 16
89 .2byte -16
90 .2byte 21
91 .section .orc_unwind_ip
92 .long .L1 - .
94 .section .orc_unwind
95 .2byte 16
96 .2byte -16
97 .2byte 20
98 .section .orc_unwind_ip
99 .long .L2 - .
101 .section .orc_unwind
102 .2byte 8
103 .2byte 0
104 .2byte 5
105 .section .orc_unwind_ip
106 .long .L3 - .
108 .section .orc_unwind
109 .2byte 0
110 .2byte 0
111 .2byte 0
112 .section .orc_unwind_ip
113 .long .L4 - .
115 # Fake Linux Kernel sections
116 .section __ksymtab,"a",@progbits
117 .section __ksymtab_gpl,"a",@progbits
118 .section .pci_fixup,"a",@progbits