[asan-asm-instrumentation] Fixed memory accesses with rbp as a base or an index register.
[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: load4b_cfa_rbp
7 # CHECK: pushl %ebx
8 # CHECK-NOT: .cfi_adjust_cfa_offset 8
9 # CHECK: movl %ebp, %ebx
10 # CHECK: .cfi_remember_state
11 # CHECK: .cfi_def_cfa_register %ebx
12 # CHECK: popl %ebx
13 # CHECK: .cfi_restore_state
14 # CHECK-NOT: .cfi_adjust_cfa_offset -8
15 # CHECK: retl
16
17         .text
18         .globl  load4b_cfa_rbp
19         .type   load4b_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         popl    %ebp
29         retl
30         .cfi_endproc
31
32 # CHECK-LABEL: load4b_cfa_rsp
33 # CHECK: pushl %ebx
34 # CHECK: .cfi_adjust_cfa_offset 4
35 # CHECK: movl %esp, %ebx
36 # CHECK: .cfi_remember_state
37 # CHECK: .cfi_def_cfa_register %ebx
38 # CHECK: popl %ebx
39 # CHECK: .cfi_restore_state
40 # CHECK: retl
41
42         .globl  load4b_cfa_rsp
43         .type   load4b_cfa_rsp,@function
44 swap_cfa_rsp:                                   # @swap_cfa_rsp
45         .cfi_startproc
46         pushl   %ebp
47         .cfi_offset %ebp, 0
48         movl    %esp, %ebp
49         movl    8(%ebp), %eax
50         popl    %ebp
51         retl
52         .cfi_endproc