ff7e4f76a75c61f0a9713f6a90c6a99fe9a56198
[oota-llvm.git] / test / Instrumentation / AddressSanitizer / X86 / asm_cfi.s
1 # The test verifies that correct DWARF directives are emitted when
2 # assembly files are instrumented.
3
4 # RUN: llvm-mc %s -triple=i386-unknown-linux-gnu -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
5
6 # CHECK-LABEL: swap_cfa_rbp
7 # CHECK: pushl %ebp
8 # CHECK-NOT: .cfi_adjust_cfa_offset 8
9 # CHECK: movl %ebp, %ebp
10 # CHECK: .cfi_remember_state
11 # CHECK: .cfi_def_cfa_register %ebp
12 # CHECK: popl %ebp
13 # CHECK: .cfi_restore_state
14 # CHECK-NOT: .cfi_adjust_cfa_offset -8
15 # CHECK: retl
16
17         .text
18         .globl  swap_cfa_rbp
19         .type   swap_cfa_rbp,@function
20 swap_cfa_rbp:                                   # @swap_cfa_rbp
21         .cfi_startproc
22         pushl   %ebp
23         .cfi_def_cfa_offset 8
24         .cfi_offset %ebp, -8
25         movl    %esp, %ebp
26         .cfi_def_cfa_register %ebp
27         movl    8(%ebp), %eax
28         movl    12(%ebp), %ecx
29         movl    (%ecx), %ecx
30         movl    %ecx, (%eax)
31         popl    %ebp
32         retl
33         .cfi_endproc
34
35 # CHECK-LABEL: swap_cfa_rsp
36 # CHECK: pushl %ebp
37 # CHECK: .cfi_adjust_cfa_offset 4
38 # CHECK: movl %esp, %ebp
39 # CHECK: .cfi_remember_state
40 # CHECK: .cfi_def_cfa_register %ebp
41 # CHECK: popl %ebp
42 # CHECK: .cfi_restore_state
43 # CHECK: retl
44
45         .globl  swap_cfa_rsp
46         .type   swap_cfa_rsp,@function
47 swap_cfa_rsp:                                   # @swap_cfa_rsp
48         .cfi_startproc
49         pushl   %ebp
50         .cfi_offset %ebp, 0
51         movl    %esp, %ebp
52         movl    8(%ebp), %eax
53         movl    12(%ebp), %ecx
54         movl    (%ecx), %ecx
55         movl    %ecx, (%eax)
56         popl    %ebp
57         retl
58         .cfi_endproc