diff options
Diffstat (limited to 'llvm/test')
4 files changed, 80 insertions, 13 deletions
diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.ll b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.ll index dfa418fb9ef..6bfb153ea93 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.ll @@ -41,5 +41,14 @@ entry: ret void } +; CHECK-LABEL: mov8b_rsp_no_cfi +; CHECK-NOT: .cfi{{[a-z_]+}} +define void @mov8b_rsp_no_cfi(i64* %dst, i64* %src) #2 { +entry: + tail call void asm sideeffect "movq ($0), %rax \0A\09movq %rax, ($1) \0A\09", "r,r,~{rax},~{memory},~{dirflag},~{fpsr},~{flags}"(i64* %src, i64* %dst) + ret void +} + attributes #0 = { nounwind sanitize_address uwtable "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" } attributes #1 = { nounwind sanitize_address uwtable "no-frame-pointer-elim"="false" } +attributes #2 = { nounwind sanitize_address "no-frame-pointer-elim"="false" } diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.s b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.s new file mode 100644 index 00000000000..ff7e4f76a75 --- /dev/null +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_cfi.s @@ -0,0 +1,58 @@ +# The test verifies that correct DWARF directives are emitted when +# assembly files are instrumented. + +# RUN: llvm-mc %s -triple=i386-unknown-linux-gnu -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s + +# CHECK-LABEL: swap_cfa_rbp +# CHECK: pushl %ebp +# CHECK-NOT: .cfi_adjust_cfa_offset 8 +# CHECK: movl %ebp, %ebp +# CHECK: .cfi_remember_state +# CHECK: .cfi_def_cfa_register %ebp +# CHECK: popl %ebp +# CHECK: .cfi_restore_state +# CHECK-NOT: .cfi_adjust_cfa_offset -8 +# CHECK: retl + + .text + .globl swap_cfa_rbp + .type swap_cfa_rbp,@function +swap_cfa_rbp: # @swap_cfa_rbp + .cfi_startproc + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset %ebp, -8 + movl %esp, %ebp + .cfi_def_cfa_register %ebp + movl 8(%ebp), %eax + movl 12(%ebp), %ecx + movl (%ecx), %ecx + movl %ecx, (%eax) + popl %ebp + retl + .cfi_endproc + +# CHECK-LABEL: swap_cfa_rsp +# CHECK: pushl %ebp +# CHECK: .cfi_adjust_cfa_offset 4 +# CHECK: movl %esp, %ebp +# CHECK: .cfi_remember_state +# CHECK: .cfi_def_cfa_register %ebp +# CHECK: popl %ebp +# CHECK: .cfi_restore_state +# CHECK: retl + + .globl swap_cfa_rsp + .type swap_cfa_rsp,@function +swap_cfa_rsp: # @swap_cfa_rsp + .cfi_startproc + pushl %ebp + .cfi_offset %ebp, 0 + movl %esp, %ebp + movl 8(%ebp), %eax + movl 12(%ebp), %ecx + movl (%ecx), %ecx + movl %ecx, (%eax) + popl %ebp + retl + .cfi_endproc diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_mov.s b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_mov.s index 74a788cf4d5..14fc056d72f 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_mov.s +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_mov.s @@ -10,13 +10,13 @@ # CHECK: callq __asan_report_load1@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movb (%rsi), %al +# CHECK: movb (%rsi), %al # -# CHECK-NEXT: leaq -128(%rsp), %rsp +# CHECK: leaq -128(%rsp), %rsp # CHECK: callq __asan_report_store1@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movb %al, (%rdi) +# CHECK: movb %al, (%rdi) mov1b: # @mov1b .cfi_startproc # BB#0: @@ -39,13 +39,13 @@ mov1b: # @mov1b # CHECK: callq __asan_report_load16@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movaps (%rsi), %xmm0 +# CHECK: movaps (%rsi), %xmm0 # -# CHECK-NEXT: leaq -128(%rsp), %rsp +# CHECK: leaq -128(%rsp), %rsp # CHECK: callq __asan_report_store16@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movaps %xmm0, (%rdi) +# CHECK: movaps %xmm0, (%rdi) mov16b: # @mov16b .cfi_startproc # BB#0: diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_swap_intel.s b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_swap_intel.s index ca3c54c1455..093c96b0efa 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_swap_intel.s +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_swap_intel.s @@ -10,25 +10,25 @@ # CHECK: callq __asan_report_load8@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movq (%rcx), %rax +# CHECK: movq (%rcx), %rax # -# CHECK-NEXT: leaq -128(%rsp), %rsp +# CHECK: leaq -128(%rsp), %rsp # CHECK: callq __asan_report_load8@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movq (%rdx), %rbx +# CHECK: movq (%rdx), %rbx # -# CHECK-NEXT: leaq -128(%rsp), %rsp +# CHECK: leaq -128(%rsp), %rsp # CHECK: callq __asan_report_store8@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movq %rbx, (%rcx) +# CHECK: movq %rbx, (%rcx) # -# CHECK-NEXT: leaq -128(%rsp), %rsp +# CHECK: leaq -128(%rsp), %rsp # CHECK: callq __asan_report_store8@PLT # CHECK: leaq 128(%rsp), %rsp # -# CHECK-NEXT: movq %rax, (%rdx) +# CHECK: movq %rax, (%rdx) swap: # @swap .cfi_startproc # BB#0: |