196 lines · plain
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# else9# 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 -gmlt14# clang++ tiny.o -o tiny -flto -fuse-ld=gold -Wl,-plugin-opt,save-temps15# clang++ -fsanitize=cfi -flto -fvisibility=hidden -c tiny.cc -o tiny.o -gmlt16# llvm-lto2 run @tiny.resolution.txt -o tiny.s -filetype=asm17 18 .text19 .file "ld-temp.o"20 .p2align 4, 0x9021 .type _Z1av.cfi,@function22_Z1av.cfi:23.Lfunc_begin0:24 .file 1 "tiny.cc"25 .loc 1 1 026 .cfi_startproc27 pushq %rbp28 .cfi_def_cfa_offset 1629 .cfi_offset %rbp, -1630 movq %rsp, %rbp31 .cfi_def_cfa_register %rbp32.Ltmp0:33 .loc 1 1 11 prologue_end34 popq %rbp35 retq36.Ltmp1:37.Lfunc_end0:38 .size _Z1av.cfi, .Lfunc_end0-_Z1av.cfi39 .cfi_endproc40 41 .p2align 4, 0x9042 .type _Z1bv.cfi,@function43_Z1bv.cfi:44.Lfunc_begin1:45 .loc 1 2 046 .cfi_startproc47 pushq %rbp48 .cfi_def_cfa_offset 1649 .cfi_offset %rbp, -1650 movq %rsp, %rbp51 .cfi_def_cfa_register %rbp52.Ltmp2:53 .loc 1 2 11 prologue_end54 popq %rbp55 retq56.Ltmp3:57.Lfunc_end1:58 .size _Z1bv.cfi, .Lfunc_end1-_Z1bv.cfi59 .cfi_endproc60 61 .hidden main62 .globl main63 .p2align 4, 0x9064 .type main,@function65main:66.Lfunc_begin2:67 .loc 1 4 068 .cfi_startproc69 pushq %rbp70 .cfi_def_cfa_offset 1671 .cfi_offset %rbp, -1672 movq %rsp, %rbp73 .cfi_def_cfa_register %rbp74 subq $32, %rsp75 movl $0, -8(%rbp)76 movl %edi, -4(%rbp)77 movq %rsi, -24(%rbp)78.Ltmp4:79 .loc 1 6 12 prologue_end80 cmpl $1, -4(%rbp)81 .loc 1 6 7 is_stmt 082 jne .LBB2_283 .loc 1 0 784 leaq _Z1av(%rip), %rax85 .loc 1 7 9 is_stmt 186 movq %rax, -16(%rbp)87 .loc 1 7 5 is_stmt 088 jmp .LBB2_389.LBB2_2:90 .loc 1 0 591 leaq _Z1bv(%rip), %rax92 .loc 1 9 9 is_stmt 193 movq %rax, -16(%rbp)94.LBB2_3:95 .loc 1 0 9 is_stmt 096 leaq .L.cfi.jumptable(%rip), %rcx97 .loc 1 11 3 is_stmt 198 movq -16(%rbp), %rax99 movq %rax, %rdx100 subq %rcx, %rdx101 movq %rdx, %rcx102 shrq $3, %rcx103 shlq $61, %rdx104 orq %rcx, %rdx105 cmpq $1, %rdx106 jbe .LBB2_5107 ud2108.LBB2_5:109 callq *%rax110 .loc 1 12 1111 movl -8(%rbp), %eax112 addq $32, %rsp113 popq %rbp114 retq115.Ltmp5:116.Lfunc_end2:117 .size main, .Lfunc_end2-main118 .cfi_endproc119 120 .p2align 3, 0x90121 .type .L.cfi.jumptable,@function122.L.cfi.jumptable:123.Lfunc_begin3:124 .cfi_startproc125 #APP126 jmp _Z1av.cfi@PLT127 int3128 int3129 int3130 jmp _Z1bv.cfi@PLT131 int3132 int3133 int3134 135 #NO_APP136.Lfunc_end3:137 .size .L.cfi.jumptable, .Lfunc_end3-.L.cfi.jumptable138 .cfi_endproc139 140 .section .debug_str,"MS",@progbits,1141.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,"",@progbits148 .byte 1149 .byte 17150 .byte 0151 .byte 37152 .byte 14153 .byte 19154 .byte 5155 .byte 3156 .byte 14157 .byte 16158 .byte 23159 .byte 27160 .byte 14161 .byte 17162 .byte 1163 .byte 18164 .byte 6165 .byte 0166 .byte 0167 .byte 0168 .section .debug_info,"",@progbits169.Lcu_begin0:170 .long 38171 .short 4172 .long .debug_abbrev173 .byte 8174 .byte 1175 .long .Linfo_string0176 .short 4177 .long .Linfo_string1178 .long .Lline_table_start0179 .long .Linfo_string2180 .quad .Lfunc_begin0181 .long .Lfunc_end2-.Lfunc_begin0182 .section .debug_ranges,"",@progbits183 .section .debug_macinfo,"",@progbits184.Lcu_macro_begin0:185 .byte 0186 187 .type _Z1av,@function188_Z1av = .L.cfi.jumptable189 .type _Z1bv,@function190_Z1bv = .L.cfi.jumptable+8191 .ident "clang version 6.0.0 (trunk 316774)"192 .section ".note.GNU-stack","",@progbits193 .section .debug_line,"",@progbits194.Lline_table_start0:195 196