• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
13#    clang++ -g tiny.cc -S -o tiny.s
14
15  .text
16  .file "tiny.cc"
17  .globl  _Z1av                   # -- Begin function _Z1av
18  .p2align  4, 0x90
19  .type _Z1av,@function
20_Z1av:                                  # @_Z1av
21.Lfunc_begin0:
22  .file 1 "tiny.cc"
23  .loc  1 1 0                   # tiny.cc:1:0
24  .cfi_startproc
25# %bb.0:
26  pushq %rbp
27  .cfi_def_cfa_offset 16
28  .cfi_offset %rbp, -16
29  movq  %rsp, %rbp
30  .cfi_def_cfa_register %rbp
31.Ltmp0:
32  .loc  1 1 11 prologue_end     # tiny.cc:1:11
33  popq  %rbp
34  .cfi_def_cfa %rsp, 8
35  retq
36.Ltmp1:
37.Lfunc_end0:
38  .size _Z1av, .Lfunc_end0-_Z1av
39  .cfi_endproc
40                                        # -- End function
41  .globl  _Z1bv                   # -- Begin function _Z1bv
42  .p2align  4, 0x90
43  .type _Z1bv,@function
44_Z1bv:                                  # @_Z1bv
45.Lfunc_begin1:
46  .loc  1 2 0                   # tiny.cc:2:0
47  .cfi_startproc
48# %bb.0:
49  pushq %rbp
50  .cfi_def_cfa_offset 16
51  .cfi_offset %rbp, -16
52  movq  %rsp, %rbp
53  .cfi_def_cfa_register %rbp
54.Ltmp2:
55  .loc  1 2 11 prologue_end     # tiny.cc:2:11
56  popq  %rbp
57  .cfi_def_cfa %rsp, 8
58  retq
59.Ltmp3:
60.Lfunc_end1:
61  .size _Z1bv, .Lfunc_end1-_Z1bv
62  .cfi_endproc
63                                        # -- End function
64  .globl  main                    # -- Begin function main
65  .p2align  4, 0x90
66  .type main,@function
67main:                                   # @main
68.Lfunc_begin2:
69  .loc  1 4 0                   # tiny.cc:4:0
70  .cfi_startproc
71# %bb.0:
72  pushq %rbp
73  .cfi_def_cfa_offset 16
74  .cfi_offset %rbp, -16
75  movq  %rsp, %rbp
76  .cfi_def_cfa_register %rbp
77  subq  $32, %rsp
78  movl  $0, -4(%rbp)
79  movl  %edi, -8(%rbp)
80  movq  %rsi, -16(%rbp)
81.Ltmp4:
82  .loc  1 6 12 prologue_end     # tiny.cc:6:12
83  cmpl  $1, -8(%rbp)
84.Ltmp5:
85  .loc  1 6 7 is_stmt 0         # tiny.cc:6:7
86  jne .LBB2_2
87# %bb.1:
88  .loc  1 0 7                   # tiny.cc:0:7
89  movabsq $_Z1av, %rax
90.Ltmp6:
91  .loc  1 7 9 is_stmt 1         # tiny.cc:7:9
92  movq  %rax, -24(%rbp)
93  .loc  1 7 5 is_stmt 0         # tiny.cc:7:5
94  jmp .LBB2_3
95.LBB2_2:
96  .loc  1 0 5                   # tiny.cc:0:5
97  movabsq $_Z1bv, %rax
98  .loc  1 9 9 is_stmt 1         # tiny.cc:9:9
99  movq  %rax, -24(%rbp)
100.Ltmp7:
101.LBB2_3:
102  .loc  1 11 3                  # tiny.cc:11:3
103  callq *-24(%rbp)
104  .loc  1 12 1                  # tiny.cc:12:1
105  movl  -4(%rbp), %eax
106  addq  $32, %rsp
107  popq  %rbp
108  .cfi_def_cfa %rsp, 8
109  retq
110.Ltmp8:
111.Lfunc_end2:
112  .size main, .Lfunc_end2-main
113  .cfi_endproc
114                                        # -- End function
115  .section  .debug_str,"MS",@progbits,1
116.Linfo_string0:
117  .asciz  "clang version 6.0.0 (trunk 317104)" # string offset=0
118.Linfo_string1:
119  .asciz  "tiny.cc"               # string offset=35
120.Linfo_string2:
121  .asciz  "/tmp/a/b"              # string offset=43
122.Linfo_string3:
123  .asciz  "_Z1av"                 # string offset=52
124.Linfo_string4:
125  .asciz  "a"                     # string offset=58
126.Linfo_string5:
127  .asciz  "_Z1bv"                 # string offset=60
128.Linfo_string6:
129  .asciz  "b"                     # string offset=66
130.Linfo_string7:
131  .asciz  "main"                  # string offset=68
132.Linfo_string8:
133  .asciz  "int"                   # string offset=73
134.Linfo_string9:
135  .asciz  "argc"                  # string offset=77
136.Linfo_string10:
137  .asciz  "argv"                  # string offset=82
138.Linfo_string11:
139  .asciz  "char"                  # string offset=87
140.Linfo_string12:
141  .asciz  "ptr"                   # string offset=92
142  .section  .debug_abbrev,"",@progbits
143  .byte 1                       # Abbreviation Code
144  .byte 17                      # DW_TAG_compile_unit
145  .byte 1                       # DW_CHILDREN_yes
146  .byte 37                      # DW_AT_producer
147  .byte 14                      # DW_FORM_strp
148  .byte 19                      # DW_AT_language
149  .byte 5                       # DW_FORM_data2
150  .byte 3                       # DW_AT_name
151  .byte 14                      # DW_FORM_strp
152  .byte 16                      # DW_AT_stmt_list
153  .byte 23                      # DW_FORM_sec_offset
154  .byte 27                      # DW_AT_comp_dir
155  .byte 14                      # DW_FORM_strp
156  .ascii  "\264B"                 # DW_AT_GNU_pubnames
157  .byte 25                      # DW_FORM_flag_present
158  .byte 17                      # DW_AT_low_pc
159  .byte 1                       # DW_FORM_addr
160  .byte 18                      # DW_AT_high_pc
161  .byte 6                       # DW_FORM_data4
162  .byte 0                       # EOM(1)
163  .byte 0                       # EOM(2)
164  .byte 2                       # Abbreviation Code
165  .byte 46                      # DW_TAG_subprogram
166  .byte 0                       # DW_CHILDREN_no
167  .byte 17                      # DW_AT_low_pc
168  .byte 1                       # DW_FORM_addr
169  .byte 18                      # DW_AT_high_pc
170  .byte 6                       # DW_FORM_data4
171  .byte 64                      # DW_AT_frame_base
172  .byte 24                      # DW_FORM_exprloc
173  .byte 110                     # DW_AT_linkage_name
174  .byte 14                      # DW_FORM_strp
175  .byte 3                       # DW_AT_name
176  .byte 14                      # DW_FORM_strp
177  .byte 58                      # DW_AT_decl_file
178  .byte 11                      # DW_FORM_data1
179  .byte 59                      # DW_AT_decl_line
180  .byte 11                      # DW_FORM_data1
181  .byte 63                      # DW_AT_external
182  .byte 25                      # DW_FORM_flag_present
183  .byte 0                       # EOM(1)
184  .byte 0                       # EOM(2)
185  .byte 3                       # Abbreviation Code
186  .byte 46                      # DW_TAG_subprogram
187  .byte 1                       # DW_CHILDREN_yes
188  .byte 17                      # DW_AT_low_pc
189  .byte 1                       # DW_FORM_addr
190  .byte 18                      # DW_AT_high_pc
191  .byte 6                       # DW_FORM_data4
192  .byte 64                      # DW_AT_frame_base
193  .byte 24                      # DW_FORM_exprloc
194  .byte 3                       # DW_AT_name
195  .byte 14                      # DW_FORM_strp
196  .byte 58                      # DW_AT_decl_file
197  .byte 11                      # DW_FORM_data1
198  .byte 59                      # DW_AT_decl_line
199  .byte 11                      # DW_FORM_data1
200  .byte 73                      # DW_AT_type
201  .byte 19                      # DW_FORM_ref4
202  .byte 63                      # DW_AT_external
203  .byte 25                      # DW_FORM_flag_present
204  .byte 0                       # EOM(1)
205  .byte 0                       # EOM(2)
206  .byte 4                       # Abbreviation Code
207  .byte 5                       # DW_TAG_formal_parameter
208  .byte 0                       # DW_CHILDREN_no
209  .byte 2                       # DW_AT_location
210  .byte 24                      # DW_FORM_exprloc
211  .byte 3                       # DW_AT_name
212  .byte 14                      # DW_FORM_strp
213  .byte 58                      # DW_AT_decl_file
214  .byte 11                      # DW_FORM_data1
215  .byte 59                      # DW_AT_decl_line
216  .byte 11                      # DW_FORM_data1
217  .byte 73                      # DW_AT_type
218  .byte 19                      # DW_FORM_ref4
219  .byte 0                       # EOM(1)
220  .byte 0                       # EOM(2)
221  .byte 5                       # Abbreviation Code
222  .byte 52                      # DW_TAG_variable
223  .byte 0                       # DW_CHILDREN_no
224  .byte 2                       # DW_AT_location
225  .byte 24                      # DW_FORM_exprloc
226  .byte 3                       # DW_AT_name
227  .byte 14                      # DW_FORM_strp
228  .byte 58                      # DW_AT_decl_file
229  .byte 11                      # DW_FORM_data1
230  .byte 59                      # DW_AT_decl_line
231  .byte 11                      # DW_FORM_data1
232  .byte 73                      # DW_AT_type
233  .byte 19                      # DW_FORM_ref4
234  .byte 0                       # EOM(1)
235  .byte 0                       # EOM(2)
236  .byte 6                       # Abbreviation Code
237  .byte 36                      # DW_TAG_base_type
238  .byte 0                       # DW_CHILDREN_no
239  .byte 3                       # DW_AT_name
240  .byte 14                      # DW_FORM_strp
241  .byte 62                      # DW_AT_encoding
242  .byte 11                      # DW_FORM_data1
243  .byte 11                      # DW_AT_byte_size
244  .byte 11                      # DW_FORM_data1
245  .byte 0                       # EOM(1)
246  .byte 0                       # EOM(2)
247  .byte 7                       # Abbreviation Code
248  .byte 15                      # DW_TAG_pointer_type
249  .byte 0                       # DW_CHILDREN_no
250  .byte 73                      # DW_AT_type
251  .byte 19                      # DW_FORM_ref4
252  .byte 0                       # EOM(1)
253  .byte 0                       # EOM(2)
254  .byte 8                       # Abbreviation Code
255  .byte 21                      # DW_TAG_subroutine_type
256  .byte 0                       # DW_CHILDREN_no
257  .byte 0                       # EOM(1)
258  .byte 0                       # EOM(2)
259  .byte 0                       # EOM(3)
260  .section  .debug_info,"",@progbits
261.Lcu_begin0:
262  .long 187                     # Length of Unit
263  .short  4                       # DWARF version number
264  .long .debug_abbrev           # Offset Into Abbrev. Section
265  .byte 8                       # Address Size (in bytes)
266  .byte 1                       # Abbrev [1] 0xb:0xb4 DW_TAG_compile_unit
267  .long .Linfo_string0          # DW_AT_producer
268  .short  4                       # DW_AT_language
269  .long .Linfo_string1          # DW_AT_name
270  .long .Lline_table_start0     # DW_AT_stmt_list
271  .long .Linfo_string2          # DW_AT_comp_dir
272                                        # DW_AT_GNU_pubnames
273  .quad .Lfunc_begin0           # DW_AT_low_pc
274  .long .Lfunc_end2-.Lfunc_begin0 # DW_AT_high_pc
275  .byte 2                       # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
276  .quad .Lfunc_begin0           # DW_AT_low_pc
277  .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
278  .byte 1                       # DW_AT_frame_base
279  .byte 86
280  .long .Linfo_string3          # DW_AT_linkage_name
281  .long .Linfo_string4          # DW_AT_name
282  .byte 1                       # DW_AT_decl_file
283  .byte 1                       # DW_AT_decl_line
284                                        # DW_AT_external
285  .byte 2                       # Abbrev [2] 0x43:0x19 DW_TAG_subprogram
286  .quad .Lfunc_begin1           # DW_AT_low_pc
287  .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
288  .byte 1                       # DW_AT_frame_base
289  .byte 86
290  .long .Linfo_string5          # DW_AT_linkage_name
291  .long .Linfo_string6          # DW_AT_name
292  .byte 1                       # DW_AT_decl_file
293  .byte 2                       # DW_AT_decl_line
294                                        # DW_AT_external
295  .byte 3                       # Abbrev [3] 0x5c:0x44 DW_TAG_subprogram
296  .quad .Lfunc_begin2           # DW_AT_low_pc
297  .long .Lfunc_end2-.Lfunc_begin2 # DW_AT_high_pc
298  .byte 1                       # DW_AT_frame_base
299  .byte 86
300  .long .Linfo_string7          # DW_AT_name
301  .byte 1                       # DW_AT_decl_file
302  .byte 4                       # DW_AT_decl_line
303  .long 160                     # DW_AT_type
304                                        # DW_AT_external
305  .byte 4                       # Abbrev [4] 0x75:0xe DW_TAG_formal_parameter
306  .byte 2                       # DW_AT_location
307  .byte 145
308  .byte 120
309  .long .Linfo_string9          # DW_AT_name
310  .byte 1                       # DW_AT_decl_file
311  .byte 4                       # DW_AT_decl_line
312  .long 160                     # DW_AT_type
313  .byte 4                       # Abbrev [4] 0x83:0xe DW_TAG_formal_parameter
314  .byte 2                       # DW_AT_location
315  .byte 145
316  .byte 112
317  .long .Linfo_string10         # DW_AT_name
318  .byte 1                       # DW_AT_decl_file
319  .byte 4                       # DW_AT_decl_line
320  .long 167                     # DW_AT_type
321  .byte 5                       # Abbrev [5] 0x91:0xe DW_TAG_variable
322  .byte 2                       # DW_AT_location
323  .byte 145
324  .byte 104
325  .long .Linfo_string12         # DW_AT_name
326  .byte 1                       # DW_AT_decl_file
327  .byte 5                       # DW_AT_decl_line
328  .long 184                     # DW_AT_type
329  .byte 0                       # End Of Children Mark
330  .byte 6                       # Abbrev [6] 0xa0:0x7 DW_TAG_base_type
331  .long .Linfo_string8          # DW_AT_name
332  .byte 5                       # DW_AT_encoding
333  .byte 4                       # DW_AT_byte_size
334  .byte 7                       # Abbrev [7] 0xa7:0x5 DW_TAG_pointer_type
335  .long 172                     # DW_AT_type
336  .byte 7                       # Abbrev [7] 0xac:0x5 DW_TAG_pointer_type
337  .long 177                     # DW_AT_type
338  .byte 6                       # Abbrev [6] 0xb1:0x7 DW_TAG_base_type
339  .long .Linfo_string11         # DW_AT_name
340  .byte 6                       # DW_AT_encoding
341  .byte 1                       # DW_AT_byte_size
342  .byte 7                       # Abbrev [7] 0xb8:0x5 DW_TAG_pointer_type
343  .long 189                     # DW_AT_type
344  .byte 8                       # Abbrev [8] 0xbd:0x1 DW_TAG_subroutine_type
345  .byte 0                       # End Of Children Mark
346  .section  .debug_ranges,"",@progbits
347  .section  .debug_macinfo,"",@progbits
348.Lcu_macro_begin0:
349  .byte 0                       # End Of Macro List Mark
350  .section  .debug_pubnames,"",@progbits
351  .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info
352.LpubNames_begin0:
353  .short  2                       # DWARF Version
354  .long .Lcu_begin0             # Offset of Compilation Unit Info
355  .long 191                     # Compilation Unit Length
356  .long 42                      # DIE offset
357  .asciz  "a"                     # External Name
358  .long 67                      # DIE offset
359  .asciz  "b"                     # External Name
360  .long 92                      # DIE offset
361  .asciz  "main"                  # External Name
362  .long 0                       # End Mark
363.LpubNames_end0:
364  .section  .debug_pubtypes,"",@progbits
365  .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info
366.LpubTypes_begin0:
367  .short  2                       # DWARF Version
368  .long .Lcu_begin0             # Offset of Compilation Unit Info
369  .long 191                     # Compilation Unit Length
370  .long 160                     # DIE offset
371  .asciz  "int"                   # External Name
372  .long 177                     # DIE offset
373  .asciz  "char"                  # External Name
374  .long 0                       # End Mark
375.LpubTypes_end0:
376
377  .ident  "clang version 6.0.0 (trunk 317104)"
378  .section  ".note.GNU-stack","",@progbits
379  .section  .debug_line,"",@progbits
380.Lline_table_start0:
381