Mitch Phillips | 7db6f7a | 2017-10-31 23:20:05 +0000 | [diff] [blame] | 1 | # RUN: llvm-mc %s -filetype obj -triple x86_64-linux-elf -o %t.o |
Vlad Tsyrklevich | b2c3ea76 | 2018-02-01 23:45:18 +0000 | [diff] [blame] | 2 | # RUN: llvm-cfi-verify %t.o 2>&1 --summarize | FileCheck %s |
Mitch Phillips | 7db6f7a | 2017-10-31 23:20:05 +0000 | [diff] [blame] | 3 | |
| 4 | # This is the same file as protected-lineinfo.s, however contains a hand- |
| 5 | # assembled function (fake_function) that has no line table information |
| 6 | # associated with it. Because there is no LT info, the indirect call made in the |
| 7 | # function should not be reported at all by llvm-cfi-verify. |
| 8 | |
| 9 | # We can test that this indirect call is ignored from the final statistics |
| 10 | # reporting of the cfi-verify program. It should only find a single indirect CF |
| 11 | # instruction at `tiny.cc:11` (see protected-lineinfo.s for the source). |
| 12 | |
Vlad Tsyrklevich | b2c3ea76 | 2018-02-01 23:45:18 +0000 | [diff] [blame] | 13 | # CHECK-NOT: Begin Instruction |
| 14 | |
Mitch Phillips | c15bdf5 | 2017-11-03 20:54:26 +0000 | [diff] [blame] | 15 | # CHECK: Expected Protected: 1 (100.00%) |
| 16 | # CHECK: Unexpected Protected: 0 (0.00%) |
| 17 | # CHECK: Expected Unprotected: 0 (0.00%) |
| 18 | # CHECK: Unexpected Unprotected (BAD): 0 (0.00%) |
Mitch Phillips | 7db6f7a | 2017-10-31 23:20:05 +0000 | [diff] [blame] | 19 | |
| 20 | .text |
| 21 | .file "ld-temp.o" |
| 22 | .p2align 4, 0x90 |
| 23 | .type fake_function,@function |
| 24 | fake_function: |
| 25 | nop |
| 26 | nop |
| 27 | nop |
| 28 | nop |
| 29 | callq *%rax |
| 30 | nop |
| 31 | nop |
| 32 | nop |
| 33 | nop |
| 34 | .type _Z1av.cfi,@function |
| 35 | _Z1av.cfi: |
| 36 | .Lfunc_begin0: |
| 37 | .file 1 "tiny.cc" |
| 38 | .loc 1 3 0 |
| 39 | .cfi_startproc |
| 40 | pushq %rbp |
| 41 | .cfi_def_cfa_offset 16 |
| 42 | .cfi_offset %rbp, -16 |
| 43 | movq %rsp, %rbp |
| 44 | .cfi_def_cfa_register %rbp |
| 45 | .Ltmp0: |
| 46 | .loc 1 3 11 prologue_end |
| 47 | popq %rbp |
| 48 | retq |
| 49 | .Ltmp1: |
| 50 | .Lfunc_end0: |
| 51 | .size _Z1av.cfi, .Lfunc_end0-_Z1av.cfi |
| 52 | .cfi_endproc |
| 53 | |
| 54 | .p2align 4, 0x90 |
| 55 | .type _Z1bv.cfi,@function |
| 56 | _Z1bv.cfi: |
| 57 | .Lfunc_begin1: |
| 58 | .loc 1 4 0 |
| 59 | .cfi_startproc |
| 60 | pushq %rbp |
| 61 | .cfi_def_cfa_offset 16 |
| 62 | .cfi_offset %rbp, -16 |
| 63 | movq %rsp, %rbp |
| 64 | .cfi_def_cfa_register %rbp |
| 65 | .Ltmp2: |
| 66 | .loc 1 4 11 prologue_end |
| 67 | popq %rbp |
| 68 | retq |
| 69 | .Ltmp3: |
| 70 | .Lfunc_end1: |
| 71 | .size _Z1bv.cfi, .Lfunc_end1-_Z1bv.cfi |
| 72 | .cfi_endproc |
| 73 | |
| 74 | .hidden main |
| 75 | .globl main |
| 76 | .p2align 4, 0x90 |
| 77 | .type main,@function |
| 78 | main: |
| 79 | .Lfunc_begin2: |
| 80 | .loc 1 6 0 |
| 81 | .cfi_startproc |
| 82 | pushq %rbp |
| 83 | .cfi_def_cfa_offset 16 |
| 84 | .cfi_offset %rbp, -16 |
| 85 | movq %rsp, %rbp |
| 86 | .cfi_def_cfa_register %rbp |
| 87 | subq $32, %rsp |
| 88 | movb $32, -1(%rbp) |
| 89 | movl $0, -12(%rbp) |
| 90 | movl %edi, -8(%rbp) |
| 91 | movq %rsi, -32(%rbp) |
| 92 | .Ltmp4: |
| 93 | .loc 1 8 12 prologue_end |
| 94 | cmpl $1, -8(%rbp) |
| 95 | .loc 1 8 7 is_stmt 0 |
| 96 | jne .LBB2_2 |
| 97 | .loc 1 0 7 |
| 98 | leaq _Z1av(%rip), %rax |
| 99 | .loc 1 9 9 is_stmt 1 |
| 100 | movq %rax, -24(%rbp) |
| 101 | .loc 1 9 5 is_stmt 0 |
| 102 | jmp .LBB2_3 |
| 103 | .LBB2_2: |
| 104 | .loc 1 0 5 |
| 105 | leaq _Z1bv(%rip), %rax |
| 106 | .loc 1 11 9 is_stmt 1 |
| 107 | movq %rax, -24(%rbp) |
| 108 | .LBB2_3: |
| 109 | .loc 1 0 9 is_stmt 0 |
| 110 | leaq .L.cfi.jumptable(%rip), %rcx |
| 111 | .loc 1 13 3 is_stmt 1 |
| 112 | movq -24(%rbp), %rax |
| 113 | movq %rax, %rdx |
| 114 | subq %rcx, %rdx |
| 115 | movq %rdx, %rcx |
| 116 | shrq $3, %rcx |
| 117 | shlq $61, %rdx |
| 118 | orq %rcx, %rdx |
| 119 | cmpq $1, %rdx |
| 120 | jbe .LBB2_5 |
| 121 | ud2 |
| 122 | .LBB2_5: |
| 123 | callq *%rax |
| 124 | .loc 1 14 11 |
| 125 | movb $-1, -1(%rbp) |
| 126 | .loc 1 15 1 |
| 127 | movl -12(%rbp), %eax |
| 128 | addq $32, %rsp |
| 129 | popq %rbp |
| 130 | retq |
| 131 | .Ltmp5: |
| 132 | .Lfunc_end2: |
| 133 | .size main, .Lfunc_end2-main |
| 134 | .cfi_endproc |
| 135 | |
| 136 | .p2align 3, 0x90 |
| 137 | .type .L.cfi.jumptable,@function |
| 138 | .L.cfi.jumptable: |
| 139 | .Lfunc_begin3: |
| 140 | .cfi_startproc |
| 141 | #APP |
| 142 | jmp _Z1av.cfi@PLT |
| 143 | int3 |
| 144 | int3 |
| 145 | int3 |
| 146 | jmp _Z1bv.cfi@PLT |
| 147 | int3 |
| 148 | int3 |
| 149 | int3 |
| 150 | |
| 151 | #NO_APP |
| 152 | .Lfunc_end3: |
| 153 | .size .L.cfi.jumptable, .Lfunc_end3-.L.cfi.jumptable |
| 154 | .cfi_endproc |
| 155 | |
| 156 | .section .debug_str,"MS",@progbits,1 |
| 157 | .Linfo_string0: |
| 158 | .asciz "clang version 6.0.0 (trunk 316774)" |
| 159 | .Linfo_string1: |
| 160 | .asciz "tiny.cc" |
| 161 | .Linfo_string2: |
| 162 | .asciz "/tmp/a/b" |
| 163 | .section .debug_abbrev,"",@progbits |
| 164 | .byte 1 |
| 165 | .byte 17 |
| 166 | .byte 0 |
| 167 | .byte 37 |
| 168 | .byte 14 |
| 169 | .byte 19 |
| 170 | .byte 5 |
| 171 | .byte 3 |
| 172 | .byte 14 |
| 173 | .byte 16 |
| 174 | .byte 23 |
| 175 | .byte 27 |
| 176 | .byte 14 |
| 177 | .byte 17 |
| 178 | .byte 1 |
| 179 | .byte 18 |
| 180 | .byte 6 |
| 181 | .byte 0 |
| 182 | .byte 0 |
| 183 | .byte 0 |
| 184 | .section .debug_info,"",@progbits |
| 185 | .Lcu_begin0: |
| 186 | .long 38 |
| 187 | .short 4 |
| 188 | .long .debug_abbrev |
| 189 | .byte 8 |
| 190 | .byte 1 |
| 191 | .long .Linfo_string0 |
| 192 | .short 4 |
| 193 | .long .Linfo_string1 |
| 194 | .long .Lline_table_start0 |
| 195 | .long .Linfo_string2 |
| 196 | .quad .Lfunc_begin0 |
| 197 | .long .Lfunc_end2-.Lfunc_begin0 |
| 198 | .section .debug_ranges,"",@progbits |
| 199 | .section .debug_macinfo,"",@progbits |
| 200 | .Lcu_macro_begin0: |
| 201 | .byte 0 |
| 202 | |
| 203 | .type _Z1av,@function |
| 204 | _Z1av = .L.cfi.jumptable |
| 205 | .type _Z1bv,@function |
| 206 | _Z1bv = .L.cfi.jumptable+8 |
| 207 | .ident "clang version 6.0.0 (trunk 316774)" |
| 208 | .section ".note.GNU-stack","",@progbits |
| 209 | .section .debug_line,"",@progbits |
| 210 | .Lline_table_start0: |
| 211 | |