170 lines · plain
1# RUN: llvm-mc %s -filetype obj -triple aarch64-- -o %t.o2# RUN: llvm-cfi-verify %t.o | FileCheck %s3 4# CHECK-LABEL: {{^Instruction: .* \(FAIL_BAD_CONDITIONAL_BRANCH\)}}5# CHECK-NEXT: tiny.cc:96 7# CHECK: Expected Protected: 0 (0.00%)8# CHECK: Unexpected Protected: 0 (0.00%)9# CHECK: Expected Unprotected: 0 (0.00%)10# CHECK: Unexpected Unprotected (BAD): 1 (100.00%)11 12# Source (tiny.cc):13# int a() { return 42; }14# int b() { return 137; }15# int main(int argc, char** argv) {16# int(*ptr)();17# if (argc == 1)18# ptr = &a;19# else20# ptr = &b;21# return ptr();22# }23# Compile with:24# clang++ -target aarch64-- -gmlt tiny.cc -S -o tiny.s25 .text26 .file "tiny.cc"27 .globl _Z1av28 .p2align 229 .type _Z1av,@function30_Z1av: // @_Z1av31.Lfunc_begin0:32 .file 1 "tiny.cc"33 .loc 1 1 0 // tiny.cc:1:034 .cfi_startproc35// BB#0:36 mov w0, #4237.Ltmp0:38 .loc 1 1 11 prologue_end // tiny.cc:1:1139 ret40.Ltmp1:41.Lfunc_end0:42 .size _Z1av, .Lfunc_end0-_Z1av43 .cfi_endproc44 45 .globl _Z1bv46 .p2align 247 .type _Z1bv,@function48_Z1bv: // @_Z1bv49.Lfunc_begin1:50 .loc 1 2 0 // tiny.cc:2:051 .cfi_startproc52// BB#0:53 mov w0, #13754.Ltmp2:55 .loc 1 2 11 prologue_end // tiny.cc:2:1156 ret57.Ltmp3:58.Lfunc_end1:59 .size _Z1bv, .Lfunc_end1-_Z1bv60 .cfi_endproc61 62 .globl main63 .p2align 264 .type main,@function65main: // @main66.Lfunc_begin2:67 .loc 1 3 0 // tiny.cc:3:068 .cfi_startproc69// BB#0:70 sub sp, sp, #48 // =4871 stp x29, x30, [sp, #32] // 8-byte Folded Spill72 add x29, sp, #32 // =3273.Lcfi0:74 .cfi_def_cfa w29, 1675.Lcfi1:76 .cfi_offset w30, -877.Lcfi2:78 .cfi_offset w29, -1679 stur wzr, [x29, #-4]80 stur w0, [x29, #-8]81 str x1, [sp, #16]82.Ltmp4:83 .loc 1 5 7 prologue_end // tiny.cc:5:784 ldur w0, [x29, #-8]85 cmp w0, #1 // =186 b.ne .LBB2_287// BB#1:88 .loc 1 0 7 is_stmt 0 // tiny.cc:0:789 adrp x8, _Z1av90 add x8, x8, :lo12:_Z1av91 .loc 1 6 9 is_stmt 1 // tiny.cc:6:992 str x8, [sp, #8]93 .loc 1 6 5 is_stmt 0 // tiny.cc:6:594 b .LBB2_395.LBB2_2:96 .loc 1 0 5 // tiny.cc:0:597 adrp x8, _Z1bv98 add x8, x8, :lo12:_Z1bv99 .loc 1 8 9 is_stmt 1 // tiny.cc:8:9100 str x8, [sp, #8]101.LBB2_3:102 .loc 1 9 10 // tiny.cc:9:10103 ldr x8, [sp, #8]104 blr x8105 .loc 1 9 3 is_stmt 0 // tiny.cc:9:3106 ldp x29, x30, [sp, #32] // 8-byte Folded Reload107 add sp, sp, #48 // =48108 ret109.Ltmp5:110.Lfunc_end2:111 .size main, .Lfunc_end2-main112 .cfi_endproc113 114 .section .debug_str,"MS",@progbits,1115.Linfo_string0:116 .asciz "clang version 4.0.1-10 (tags/RELEASE_401/final)" // string offset=0117.Linfo_string1:118 .asciz "tiny.cc" // string offset=48119.Linfo_string2:120 .asciz "/tmp" // string offset=56121 .section .debug_loc,"",@progbits122 .section .debug_abbrev,"",@progbits123.Lsection_abbrev:124 .byte 1 // Abbreviation Code125 .byte 17 // DW_TAG_compile_unit126 .byte 0 // DW_CHILDREN_no127 .byte 37 // DW_AT_producer128 .byte 14 // DW_FORM_strp129 .byte 19 // DW_AT_language130 .byte 5 // DW_FORM_data2131 .byte 3 // DW_AT_name132 .byte 14 // DW_FORM_strp133 .byte 16 // DW_AT_stmt_list134 .byte 23 // DW_FORM_sec_offset135 .byte 27 // DW_AT_comp_dir136 .byte 14 // DW_FORM_strp137 .byte 17 // DW_AT_low_pc138 .byte 1 // DW_FORM_addr139 .byte 18 // DW_AT_high_pc140 .byte 6 // DW_FORM_data4141 .byte 0 // EOM(1)142 .byte 0 // EOM(2)143 .byte 0 // EOM(3)144 .section .debug_info,"",@progbits145.Lsection_info:146.Lcu_begin0:147 .word 38 // Length of Unit148 .hword 4 // DWARF version number149 .word .Lsection_abbrev // Offset Into Abbrev. Section150 .byte 8 // Address Size (in bytes)151 .byte 1 // Abbrev [1] 0xb:0x1f DW_TAG_compile_unit152 .word .Linfo_string0 // DW_AT_producer153 .hword 4 // DW_AT_language154 .word .Linfo_string1 // DW_AT_name155 .word .Lline_table_start0 // DW_AT_stmt_list156 .word .Linfo_string2 // DW_AT_comp_dir157 .xword .Lfunc_begin0 // DW_AT_low_pc158 .word .Lfunc_end2-.Lfunc_begin0 // DW_AT_high_pc159 .section .debug_ranges,"",@progbits160.Ldebug_range:161 .section .debug_macinfo,"",@progbits162.Ldebug_macinfo:163.Lcu_macro_begin0:164 .byte 0 // End Of Macro List Mark165 166 .ident "clang version 4.0.1-10 (tags/RELEASE_401/final)"167 .section ".note.GNU-stack","",@progbits168 .section .debug_line,"",@progbits169.Lline_table_start0:170