Author: foad Date: Thu Jun 25 05:35:19 2015 New Revision: 240628 URL: http://llvm.org/viewvc/llvm-project?rev=240628&view=rev Log: Teach Clang about the PPC64 memory sanitizer implementation.
Summary: This is the Clang part of the PPC64 memory sanitizer implementation in D10648. Reviewers: kcc, eugenis, willschm, wschmidt, samsonov Reviewed By: samsonov Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10650 Added: cfe/trunk/test/Driver/msan.c Modified: cfe/trunk/lib/Driver/ToolChains.cpp cfe/trunk/test/Driver/fsanitize.c Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=240628&r1=240627&r2=240628&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Jun 25 05:35:19 2015 @@ -3669,6 +3669,8 @@ SanitizerMask Linux::getSupportedSanitiz const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; const bool IsMIPS64 = getTriple().getArch() == llvm::Triple::mips64 || getTriple().getArch() == llvm::Triple::mips64el; + const bool IsPowerPC64 = getTriple().getArch() == llvm::Triple::ppc64 || + getTriple().getArch() == llvm::Triple::ppc64le; SanitizerMask Res = ToolChain::getSupportedSanitizers(); Res |= SanitizerKind::Address; Res |= SanitizerKind::KernelAddress; @@ -3676,9 +3678,10 @@ SanitizerMask Linux::getSupportedSanitiz if (IsX86_64 || IsMIPS64) { Res |= SanitizerKind::DataFlow; Res |= SanitizerKind::Leak; - Res |= SanitizerKind::Memory; Res |= SanitizerKind::Thread; } + if (IsX86_64 || IsMIPS64 || IsPowerPC64) + Res |= SanitizerKind::Memory; if (IsX86 || IsX86_64) { Res |= SanitizerKind::Function; Res |= SanitizerKind::SafeStack; Modified: cfe/trunk/test/Driver/fsanitize.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=240628&r1=240627&r2=240628&view=diff ============================================================================== --- cfe/trunk/test/Driver/fsanitize.c (original) +++ cfe/trunk/test/Driver/fsanitize.c Thu Jun 25 05:35:19 2015 @@ -263,3 +263,7 @@ // SP: "-fsanitize=safe-stack" // SP-ASAN-NOT: stack-protector // SP-ASAN: "-fsanitize=address,safe-stack" + +// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM +// RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM +// CHECK-SANM: "-fsanitize=memory" Added: cfe/trunk/test/Driver/msan.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msan.c?rev=240628&view=auto ============================================================================== --- cfe/trunk/test/Driver/msan.c (added) +++ cfe/trunk/test/Driver/msan.c Thu Jun 25 05:35:19 2015 @@ -0,0 +1,12 @@ +// RUN: %clang -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O1 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O3 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target mips64-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target mips64el-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// Verify that -fsanitize=memory invokes msan instrumentation. + +int foo(int *a) { return *a; } +// CHECK: __msan_init _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits