Fixup for r188058: assume hasAsanZeroBaseShadow() is false if ASan is not needed
authorAlexey Samsonov <samsonov@google.com>
Fri, 9 Aug 2013 10:56:42 +0000 (10:56 +0000)
committerAlexey Samsonov <samsonov@google.com>
Fri, 9 Aug 2013 10:56:42 +0000 (10:56 +0000)
llvm-svn: 188068

clang/lib/Driver/SanitizerArgs.cpp
clang/test/Driver/fsanitize.c

index 8851316c83c24ac1493f6f948612a2b9d9345bc6..9351e51013628efa4b8e96533422bdac264b6c91 100644 (file)
@@ -193,6 +193,8 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
 }
 
 bool SanitizerArgs::hasAsanZeroBaseShadow(const ToolChain &TC) const {
+  if (!needsAsanRt())
+    return false;
   if (AsanZeroBaseShadow != AZBSK_Default)
     return AsanZeroBaseShadow == AZBSK_On;
   // Zero-base shadow is used by default only on Android.
index 07e7f1e0f1d5cbf66979d3ac12aef754a66a980c..2e9b5c883dd31f32788c365a3f77fd92668b2807 100644 (file)
 // CHECK-ANDROID-ASAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2"
 // CHECK-ANDROID-ASAN-NO-PIE: "-pie"
 
+// RUN: %clang -target arm-linux-androideabi %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-NO-ASAN
+// CHECK-ANDROID-NO-ASAN: "-mrelocation-model" "static"
+
 // RUN: %clang -target arm-linux-androideabi -fsanitize=address -fsanitize-address-zero-base-shadow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-ASAN-ZERO-BASE
 // CHECK-ANDROID-ASAN-ZERO-BASE-NOT: argument unused during compilation