diff options
author | Yuri Gorshenin <ygorshenin@google.com> | 2014-10-13 09:37:47 +0000 |
---|---|---|
committer | Yuri Gorshenin <ygorshenin@google.com> | 2014-10-13 09:37:47 +0000 |
commit | 46853b55fa6a0feb7c4062cab0665d488f1dba28 (patch) | |
tree | 21bf4f60ba3dd444989997b0a9b8c8edbe60628a /llvm/test | |
parent | 106f68cd97cc7aa2c14e5deb1f01f10c48593ada (diff) | |
download | bcm5719-llvm-46853b55fa6a0feb7c4062cab0665d488f1dba28.tar.gz bcm5719-llvm-46853b55fa6a0feb7c4062cab0665d488f1dba28.zip |
[asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.
Summary: [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.
Reviewers: eugenis
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5599
llvm-svn: 219602
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Instrumentation/AddressSanitizer/X86/asm_rsp_mem_op.s | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/AddressSanitizer/X86/asm_rsp_mem_op.s b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_rsp_mem_op.s new file mode 100644 index 00000000000..e40ecde0daa --- /dev/null +++ b/llvm/test/Instrumentation/AddressSanitizer/X86/asm_rsp_mem_op.s @@ -0,0 +1,45 @@ +# The test verifies that memory references through %rsp are correctly +# adjusted after instrumentation. + +# RUN: llvm-mc %s -triple=x86_64-unknown-linux-gnu -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s + +# CHECK-LABEL: rsp_access +# CHECK: leaq -128(%rsp), %rsp +# CHECK: pushq %rax +# CHECK: pushq %rdi +# CHECK: pushfq +# CHECK: leaq 160(%rsp), %rdi +# CHECK: callq __asan_report_load8@PLT +# CHECK: popfq +# CHECK: popq %rdi +# CHECK: popq %rax +# CHECK: leaq 128(%rsp), %rsp +# CHECK: movq 8(%rsp), %rax +# CHECK: retq + + .text + .globl rsp_access + .type rsp_access,@function +rsp_access: + movq 8(%rsp), %rax + retq + +# CHECK-LABEL: rsp_32bit_access +# CHECK: leaq -128(%rsp), %rsp +# CHECK: pushq %rax +# CHECK: pushq %rdi +# CHECK: pushfq +# CHECK: leaq 2147483647(%rsp), %rdi +# CHECK: leaq 145(%rdi), %rdi +# CHECK: callq __asan_report_load8@PLT +# CHECK: popfq +# CHECK: popq %rdi +# CHECK: popq %rax +# CHECK: leaq 128(%rsp), %rsp +# CHECK: movq 2147483640(%rsp), %rax +# CHECK: retq + .globl rsp_32bit_access + .type rsp_32bit_access,@function +rsp_32bit_access: + movq 2147483640(%rsp), %rax + retq |