184 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: .* \(PROTECTED\)}}5# CHECK-NEXT: tiny.cc:96 7# CHECK: Expected Protected: 1 (100.00%)8# CHECK: Unexpected Protected: 0 (0.00%)9# CHECK: Expected Unprotected: 0 (0.00%)10# CHECK: Unexpected Unprotected (BAD): 0 (0.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 .text24 .file "ld-temp.o"25 .p2align 226 .type _Z1av.cfi,@function27_Z1av.cfi:28.Lfunc_begin0:29 .file 1 "/tmp/tiny.cc"30 .loc 1 1 031 .cfi_startproc32 .loc 1 1 11 prologue_end33 mov w0, #4234 ret35.Ltmp0:36.Lfunc_end0:37 .size _Z1av.cfi, .Lfunc_end0-_Z1av.cfi38 .cfi_endproc39 40 .p2align 241 .type _Z1bv.cfi,@function42_Z1bv.cfi:43.Lfunc_begin1:44 .loc 1 2 045 .cfi_startproc46 .loc 1 2 11 prologue_end47 mov w0, #13748 ret49.Ltmp1:50.Lfunc_end1:51 .size _Z1bv.cfi, .Lfunc_end1-_Z1bv.cfi52 .cfi_endproc53 54 .p2align 255 .type main,@function56main:57.Lfunc_begin2:58 .loc 1 3 059 .cfi_startproc60 sub sp, sp, #4861 stp x29, x30, [sp, #32]62 add x29, sp, #3263 .cfi_def_cfa w29, 1664 .cfi_offset w30, -865 .cfi_offset w29, -1666 stur wzr, [x29, #-4]67 stur w0, [x29, #-8]68 str x1, [sp, #16]69.Ltmp2:70 .loc 1 5 7 prologue_end71 ldur w8, [x29, #-8]72 cmp w8, #173 b.ne .LBB2_274 .loc 1 0 7 is_stmt 075 adrp x8, _Z1av76 add x8, x8, :lo12:_Z1av77 .loc 1 6 9 is_stmt 178 str x8, [sp, #8]79 .loc 1 6 5 is_stmt 080 b .LBB2_381.LBB2_2:82 .loc 1 0 583 adrp x8, _Z1bv84 add x8, x8, :lo12:_Z1bv85 .loc 1 8 9 is_stmt 186 str x8, [sp, #8]87.LBB2_3:88 .loc 1 0 9 is_stmt 089 adrp x8, .L.cfi.jumptable90 add x9, x8, :lo12:.L.cfi.jumptable91 .loc 1 9 10 is_stmt 192 ldr x8, [sp, #8]93 sub x9, x8, x994 lsr x10, x9, #295 orr x9, x10, x9, lsl #6296 cmp x9, #197 b.ls .LBB2_598 brk #0x199.LBB2_5:100 blr x8101 .loc 1 9 3 is_stmt 0102 ldp x29, x30, [sp, #32]103 add sp, sp, #48104 ret105.Ltmp3:106.Lfunc_end2:107 .size main, .Lfunc_end2-main108 .cfi_endproc109 110 .p2align 2111 .type .L.cfi.jumptable,@function112.L.cfi.jumptable:113.Lfunc_begin3:114 .cfi_startproc115 //APP116 b _Z1av.cfi117 b _Z1bv.cfi118 119 //NO_APP120.Lfunc_end3:121 .size .L.cfi.jumptable, .Lfunc_end3-.L.cfi.jumptable122 .cfi_endproc123 124 .type .L__unnamed_1,@object125 .section .rodata,"a",@progbits126 .p2align 2127.L__unnamed_1:128 .size .L__unnamed_1, 0129 130 .section .debug_str,"MS",@progbits,1131.Linfo_string0:132 .asciz "clang version 7.0.0 (trunk 335774) (llvm/trunk 335775)"133.Linfo_string1:134 .asciz "tiny.cc"135.Linfo_string2:136 .asciz ""137 .section .debug_abbrev,"",@progbits138 .byte 1139 .byte 17140 .byte 0141 .byte 37142 .byte 14143 .byte 19144 .byte 5145 .byte 3146 .byte 14147 .byte 16148 .byte 23149 .byte 27150 .byte 14151 .byte 17152 .byte 1153 .byte 18154 .byte 6155 .byte 0156 .byte 0157 .byte 0158 .section .debug_info,"",@progbits159.Lcu_begin0:160 .word 38161 .hword 4162 .word .debug_abbrev163 .byte 8164 .byte 1165 .word .Linfo_string0166 .hword 4167 .word .Linfo_string1168 .word .Lline_table_start0169 .word .Linfo_string2170 .xword .Lfunc_begin0171 .word .Lfunc_end2-.Lfunc_begin0172 .section .debug_ranges,"",@progbits173 .section .debug_macinfo,"",@progbits174 .byte 0175 176 .type _Z1av,@function177.set _Z1av, .L.cfi.jumptable178 .type _Z1bv,@function179.set _Z1bv, .L.cfi.jumptable+4180 .ident "clang version 7.0.0 (trunk 335774) (llvm/trunk 335775)"181 .section ".note.GNU-stack","",@progbits182 .section .debug_line,"",@progbits183.Lline_table_start0:184