From d6af41b2eb87a1f822932aa19b4a9f6039de11fd Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Wed, 23 Apr 2014 11:16:03 +0000 Subject: Create MCTargetOptions. For now it contains a single flag, SanitizeAddress, which enables AddressSanitizer instrumentation of inline assembly. Patch by Yuri Gorshenin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206971 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/AddressSanitizer/X86/asm_attr.ll | 20 ++++++++++++++++++++ test/Instrumentation/AddressSanitizer/X86/asm_mov.ll | 4 ++-- test/Instrumentation/AddressSanitizer/X86/asm_mov.s | 2 +- .../X86/asm_mov_no_instrumentation.s | 20 -------------------- 4 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 test/Instrumentation/AddressSanitizer/X86/asm_attr.ll (limited to 'test') diff --git a/test/Instrumentation/AddressSanitizer/X86/asm_attr.ll b/test/Instrumentation/AddressSanitizer/X86/asm_attr.ll new file mode 100644 index 0000000000..5beebb41f3 --- /dev/null +++ b/test/Instrumentation/AddressSanitizer/X86/asm_attr.ll @@ -0,0 +1,20 @@ +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-LABEL: mov_no_attr +; CHECK-NOT: callq __sanitizer_sanitize_load8@PLT +; CHECK-NOT: callq __sanitizer_sanitize_store8@PLT +define void @mov_no_attr(i64* %dst, i64* %src) { + tail call void asm sideeffect "movq ($1), %rax \0A\09movq %rax, ($0) \0A\09", "r,r,~{memory},~{rax},~{dirflag},~{fpsr},~{flags}"(i64* %dst, i64* %src) + ret void +} + +; CHECK-LABEL: mov_sanitize +; CHECK: callq __sanitizer_sanitize_load8@PLT +; CHECK: callq __sanitizer_sanitize_store8@PLT +define void @mov_sanitize(i64* %dst, i64* %src) sanitize_address { + tail call void asm sideeffect "movq ($1), %rax \0A\09movq %rax, ($0) \0A\09", "r,r,~{memory},~{rax},~{dirflag},~{fpsr},~{flags}"(i64* %dst, i64* %src) + ret void +} diff --git a/test/Instrumentation/AddressSanitizer/X86/asm_mov.ll b/test/Instrumentation/AddressSanitizer/X86/asm_mov.ll index 7af8139955..edb4784a58 100644 --- a/test/Instrumentation/AddressSanitizer/X86/asm_mov.ll +++ b/test/Instrumentation/AddressSanitizer/X86/asm_mov.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asan-instrument-inline-assembly | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -113,7 +113,7 @@ entry: ret void } -attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind uwtable sanitize_address "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { nounwind } !0 = metadata !{i32 98, i32 122, i32 160} diff --git a/test/Instrumentation/AddressSanitizer/X86/asm_mov.s b/test/Instrumentation/AddressSanitizer/X86/asm_mov.s index 9001067247..5ae380df71 100644 --- a/test/Instrumentation/AddressSanitizer/X86/asm_mov.s +++ b/test/Instrumentation/AddressSanitizer/X86/asm_mov.s @@ -1,4 +1,4 @@ -# RUN: llvm-mc %s -triple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asan-instrument-inline-assembly | FileCheck %s +# RUN: llvm-mc %s -triple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address | FileCheck %s .text .globl mov1b diff --git a/test/Instrumentation/AddressSanitizer/X86/asm_mov_no_instrumentation.s b/test/Instrumentation/AddressSanitizer/X86/asm_mov_no_instrumentation.s index a9ef4df9d3..cc05527b12 100644 --- a/test/Instrumentation/AddressSanitizer/X86/asm_mov_no_instrumentation.s +++ b/test/Instrumentation/AddressSanitizer/X86/asm_mov_no_instrumentation.s @@ -20,25 +20,5 @@ mov1b: # @mov1b .size mov1b, .Ltmp0-mov1b .cfi_endproc - .globl mov16b - .align 16, 0x90 - .type mov16b,@function -# CHECK-LABEL: mov16b -# CHECK-NOT: callq __sanitizer_sanitize_load16@PLT -# CHECK-NOT: callq __sanitizer_sanitize_store16@PLT -mov16b: # @mov16b - .cfi_startproc -# BB#0: - #APP - movaps (%rsi), %xmm0 - movaps %xmm0, (%rdi) - - #NO_APP - retq -.Ltmp1: - .size mov16b, .Ltmp1-mov16b - .cfi_endproc - - .ident "clang version 3.5 " .section ".note.GNU-stack","",@progbits -- cgit v1.2.3