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++ -gmlt 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 retq 35.Ltmp1: 36.Lfunc_end0: 37 .size _Z1av, .Lfunc_end0-_Z1av 38 .cfi_endproc 39 # -- End function 40 .globl _Z1bv # -- Begin function _Z1bv 41 .p2align 4, 0x90 42 .type _Z1bv,@function 43_Z1bv: # @_Z1bv 44.Lfunc_begin1: 45 .loc 1 2 0 # tiny.cc:2:0 46 .cfi_startproc 47# %bb.0: 48 pushq %rbp 49 .cfi_def_cfa_offset 16 50 .cfi_offset %rbp, -16 51 movq %rsp, %rbp 52 .cfi_def_cfa_register %rbp 53.Ltmp2: 54 .loc 1 2 11 prologue_end # tiny.cc:2:11 55 popq %rbp 56 retq 57.Ltmp3: 58.Lfunc_end1: 59 .size _Z1bv, .Lfunc_end1-_Z1bv 60 .cfi_endproc 61 # -- End function 62 .globl main # -- Begin function main 63 .p2align 4, 0x90 64 .type main,@function 65main: # @main 66.Lfunc_begin2: 67 .loc 1 4 0 # tiny.cc:4:0 68 .cfi_startproc 69# %bb.0: 70 pushq %rbp 71 .cfi_def_cfa_offset 16 72 .cfi_offset %rbp, -16 73 movq %rsp, %rbp 74 .cfi_def_cfa_register %rbp 75 subq $32, %rsp 76 movl $0, -4(%rbp) 77 movl %edi, -8(%rbp) 78 movq %rsi, -16(%rbp) 79.Ltmp4: 80 .loc 1 6 12 prologue_end # tiny.cc:6:12 81 cmpl $1, -8(%rbp) 82 .loc 1 6 7 is_stmt 0 # tiny.cc:6:7 83 jne .LBB2_2 84# %bb.1: 85 .loc 1 0 7 # tiny.cc:0:7 86 movabsq $_Z1av, %rax 87 .loc 1 7 9 is_stmt 1 # tiny.cc:7:9 88 movq %rax, -24(%rbp) 89 .loc 1 7 5 is_stmt 0 # tiny.cc:7:5 90 jmp .LBB2_3 91.LBB2_2: 92 .loc 1 0 5 # tiny.cc:0:5 93 movabsq $_Z1bv, %rax 94 .loc 1 9 9 is_stmt 1 # tiny.cc:9:9 95 movq %rax, -24(%rbp) 96.LBB2_3: 97 .loc 1 11 3 # tiny.cc:11:3 98 callq *-24(%rbp) 99 .loc 1 12 1 # tiny.cc:12:1 100 movl -4(%rbp), %eax 101 addq $32, %rsp 102 popq %rbp 103 retq 104.Ltmp5: 105.Lfunc_end2: 106 .size main, .Lfunc_end2-main 107 .cfi_endproc 108 # -- End function 109 .section .debug_str,"MS",@progbits,1 110.Linfo_string0: 111 .asciz "clang version 6.0.0 (trunk 316774)" # string offset=0 112.Linfo_string1: 113 .asciz "tiny.cc" # string offset=35 114.Linfo_string2: 115 .asciz "/tmp/a/b" # string offset=43 116 .section .debug_abbrev,"",@progbits 117 .byte 1 # Abbreviation Code 118 .byte 17 # DW_TAG_compile_unit 119 .byte 0 # DW_CHILDREN_no 120 .byte 37 # DW_AT_producer 121 .byte 14 # DW_FORM_strp 122 .byte 19 # DW_AT_language 123 .byte 5 # DW_FORM_data2 124 .byte 3 # DW_AT_name 125 .byte 14 # DW_FORM_strp 126 .byte 16 # DW_AT_stmt_list 127 .byte 23 # DW_FORM_sec_offset 128 .byte 27 # DW_AT_comp_dir 129 .byte 14 # DW_FORM_strp 130 .byte 17 # DW_AT_low_pc 131 .byte 1 # DW_FORM_addr 132 .byte 18 # DW_AT_high_pc 133 .byte 6 # DW_FORM_data4 134 .byte 0 # EOM(1) 135 .byte 0 # EOM(2) 136 .byte 0 # EOM(3) 137 .section .debug_info,"",@progbits 138.Lcu_begin0: 139 .long 38 # Length of Unit 140 .short 4 # DWARF version number 141 .long .debug_abbrev # Offset Into Abbrev. Section 142 .byte 8 # Address Size (in bytes) 143 .byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit 144 .long .Linfo_string0 # DW_AT_producer 145 .short 4 # DW_AT_language 146 .long .Linfo_string1 # DW_AT_name 147 .long .Lline_table_start0 # DW_AT_stmt_list 148 .long .Linfo_string2 # DW_AT_comp_dir 149 .quad .Lfunc_begin0 # DW_AT_low_pc 150 .long .Lfunc_end2-.Lfunc_begin0 # DW_AT_high_pc 151 .section .debug_ranges,"",@progbits 152 .section .debug_macinfo,"",@progbits 153.Lcu_macro_begin0: 154 .byte 0 # End Of Macro List Mark 155 156 .ident "clang version 6.0.0 (trunk 316774)" 157 .section ".note.GNU-stack","",@progbits 158 .section .debug_line,"",@progbits 159.Lline_table_start0: 160