xref: /llvm-project/llvm/test/tools/llvm-cfi-verify/X86/Inputs/protected-lineinfo.s (revision c15bdf5598154277d21cae47cf8dae25b44398ef)
1# Source (tiny.cc):
2#   void a() {}
3#   void b() {}
4#   int main(int argc, char** argv) {
5#     void(*ptr)();
6#     if (argc == 1)
7#       ptr = &a;
8#     else
9#       ptr = &b;
10#     ptr();
11#   }
12# Compile with (output is in tiny.s.0):
13#    clang++ -flto -fsanitize=cfi -fvisibility=hidden -c tiny.cc -o tiny.o -gmlt
14#    clang++ tiny.o -o tiny -flto -fuse-ld=gold -Wl,-plugin-opt,save-temps
15#    clang++ -fsanitize=cfi -flto -fvisibility=hidden -c tiny.cc -o tiny.o -gmlt
16#    llvm-lto2 run @tiny.resolution.txt -o tiny.s -filetype=asm
17
18  .text
19  .file "ld-temp.o"
20  .p2align  4, 0x90
21  .type _Z1av.cfi,@function
22_Z1av.cfi:
23.Lfunc_begin0:
24  .file 1 "tiny.cc"
25  .loc  1 1 0
26  .cfi_startproc
27  pushq %rbp
28  .cfi_def_cfa_offset 16
29  .cfi_offset %rbp, -16
30  movq  %rsp, %rbp
31  .cfi_def_cfa_register %rbp
32.Ltmp0:
33  .loc  1 1 11 prologue_end
34  popq  %rbp
35  retq
36.Ltmp1:
37.Lfunc_end0:
38  .size _Z1av.cfi, .Lfunc_end0-_Z1av.cfi
39  .cfi_endproc
40
41  .p2align  4, 0x90
42  .type _Z1bv.cfi,@function
43_Z1bv.cfi:
44.Lfunc_begin1:
45  .loc  1 2 0
46  .cfi_startproc
47  pushq %rbp
48  .cfi_def_cfa_offset 16
49  .cfi_offset %rbp, -16
50  movq  %rsp, %rbp
51  .cfi_def_cfa_register %rbp
52.Ltmp2:
53  .loc  1 2 11 prologue_end
54  popq  %rbp
55  retq
56.Ltmp3:
57.Lfunc_end1:
58  .size _Z1bv.cfi, .Lfunc_end1-_Z1bv.cfi
59  .cfi_endproc
60
61  .hidden main
62  .globl  main
63  .p2align  4, 0x90
64  .type main,@function
65main:
66.Lfunc_begin2:
67  .loc  1 4 0
68  .cfi_startproc
69  pushq %rbp
70  .cfi_def_cfa_offset 16
71  .cfi_offset %rbp, -16
72  movq  %rsp, %rbp
73  .cfi_def_cfa_register %rbp
74  subq  $32, %rsp
75  movl  $0, -8(%rbp)
76  movl  %edi, -4(%rbp)
77  movq  %rsi, -24(%rbp)
78.Ltmp4:
79  .loc  1 6 12 prologue_end
80  cmpl  $1, -4(%rbp)
81  .loc  1 6 7 is_stmt 0
82  jne .LBB2_2
83  .loc  1 0 7
84  leaq  _Z1av(%rip), %rax
85  .loc  1 7 9 is_stmt 1
86  movq  %rax, -16(%rbp)
87  .loc  1 7 5 is_stmt 0
88  jmp .LBB2_3
89.LBB2_2:
90  .loc  1 0 5
91  leaq  _Z1bv(%rip), %rax
92  .loc  1 9 9 is_stmt 1
93  movq  %rax, -16(%rbp)
94.LBB2_3:
95  .loc  1 0 9 is_stmt 0
96  leaq  .L.cfi.jumptable(%rip), %rcx
97  .loc  1 11 3 is_stmt 1
98  movq  -16(%rbp), %rax
99  movq  %rax, %rdx
100  subq  %rcx, %rdx
101  movq  %rdx, %rcx
102  shrq  $3, %rcx
103  shlq  $61, %rdx
104  orq %rcx, %rdx
105  cmpq  $1, %rdx
106  jbe .LBB2_5
107  ud2
108.LBB2_5:
109  callq *%rax
110  .loc  1 12 1
111  movl  -8(%rbp), %eax
112  addq  $32, %rsp
113  popq  %rbp
114  retq
115.Ltmp5:
116.Lfunc_end2:
117  .size main, .Lfunc_end2-main
118  .cfi_endproc
119
120  .p2align  3, 0x90
121  .type .L.cfi.jumptable,@function
122.L.cfi.jumptable:
123.Lfunc_begin3:
124  .cfi_startproc
125  #APP
126  jmp _Z1av.cfi@PLT
127  int3
128  int3
129  int3
130  jmp _Z1bv.cfi@PLT
131  int3
132  int3
133  int3
134
135  #NO_APP
136.Lfunc_end3:
137  .size .L.cfi.jumptable, .Lfunc_end3-.L.cfi.jumptable
138  .cfi_endproc
139
140  .section  .debug_str,"MS",@progbits,1
141.Linfo_string0:
142  .asciz  "clang version 6.0.0 (trunk 316774)"
143.Linfo_string1:
144  .asciz  "tiny.cc"
145.Linfo_string2:
146  .asciz  ""
147  .section  .debug_abbrev,"",@progbits
148  .byte 1
149  .byte 17
150  .byte 0
151  .byte 37
152  .byte 14
153  .byte 19
154  .byte 5
155  .byte 3
156  .byte 14
157  .byte 16
158  .byte 23
159  .byte 27
160  .byte 14
161  .byte 17
162  .byte 1
163  .byte 18
164  .byte 6
165  .byte 0
166  .byte 0
167  .byte 0
168  .section  .debug_info,"",@progbits
169.Lcu_begin0:
170  .long 38
171  .short  4
172  .long .debug_abbrev
173  .byte 8
174  .byte 1
175  .long .Linfo_string0
176  .short  4
177  .long .Linfo_string1
178  .long .Lline_table_start0
179  .long .Linfo_string2
180  .quad .Lfunc_begin0
181  .long .Lfunc_end2-.Lfunc_begin0
182  .section  .debug_ranges,"",@progbits
183  .section  .debug_macinfo,"",@progbits
184.Lcu_macro_begin0:
185  .byte 0
186
187  .type _Z1av,@function
188_Z1av = .L.cfi.jumptable
189  .type _Z1bv,@function
190_Z1bv = .L.cfi.jumptable+8
191  .ident  "clang version 6.0.0 (trunk 316774)"
192  .section  ".note.GNU-stack","",@progbits
193  .section  .debug_line,"",@progbits
194.Lline_table_start0:
195
196