[PATCH] D15624: Add iOS/watchOS/tvOS support for ASan (clang part)
Anna Zaks via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 17 12:38:56 PST 2015
zaks.anna created this revision.
zaks.anna added reviewers: kcc, cfe-commits.
Change the clang driver to accept ASan on iOS/watchOS/tvOS.
This change along with the corresponding changes in llvm and compiler-rt complete ASan support for iOS/watchOS/tvOS.
http://reviews.llvm.org/D15624
Files:
lib/Driver/ToolChains.cpp
test/Driver/fsanitize.c
Index: test/Driver/fsanitize.c
===================================================================
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -230,7 +230,7 @@
// CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr
// RUN: %clang -target armv7-apple-ios7 -miphoneos-version-min=7.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS
-// CHECK-ASAN-IOS: unsupported option '-fsanitize=address' for target 'arm-apple-ios7'
+// CHECK-ASAN-IOS: -fsanitize=address
// RUN: %clang -target i386-pc-openbsd -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-OPENBSD
// CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 'i386-pc-openbsd'
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -363,9 +363,24 @@
// Sanitizer runtime libraries requires C++.
AddCXXStdlibLibArgs(Args, CmdArgs);
}
- // ASan is not supported on watchOS.
- assert(isTargetMacOS() || isTargetIOSSimulator());
- StringRef OS = isTargetMacOS() ? "osx" : "iossim";
+
+ StringRef OS = "";
+ if (isTargetMacOS())
+ OS = "osx";
+ if (isTargetWatchOSSimulator())
+ OS = "watchossim";
+ if (isTargetWatchOS())
+ OS = "watchos";
+ if (isTargetIOSSimulator())
+ OS = "iossim";
+ if (isTargetIPhoneOS())
+ OS = "ios";
+ if (isTargetTvOSSimulator())
+ OS = "tvossim";
+ if (isTargetTvOS())
+ OS = "tvos";
+ assert(!OS.empty());
+
AddLinkRuntimeLib(
Args, CmdArgs,
(Twine("libclang_rt.") + Sanitizer + "_" + OS + "_dynamic.dylib").str(),
@@ -1213,8 +1228,7 @@
SanitizerMask Darwin::getSupportedSanitizers() const {
SanitizerMask Res = ToolChain::getSupportedSanitizers();
- if (isTargetMacOS() || isTargetIOSSimulator())
- Res |= SanitizerKind::Address;
+ Res |= SanitizerKind::Address;
if (isTargetMacOS()) {
if (!isMacosxVersionLT(10, 9))
Res |= SanitizerKind::Vptr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15624.43171.patch
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151217/21bcd3bd/attachment.bin>
More information about the cfe-commits
mailing list