[PATCH] D36779: [Driver] SafeStack does not need a runtime library on Fuchsia
Roland McGrath via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 15 19:56:04 PDT 2017
mcgrathr created this revision.
mcgrathr added a project: Sanitizers.
Repository:
rL LLVM
https://reviews.llvm.org/D36779
Files:
include/clang/Driver/SanitizerArgs.h
lib/Driver/SanitizerArgs.cpp
test/Driver/fuchsia.c
Index: test/Driver/fuchsia.c
===================================================================
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -45,6 +45,8 @@
// RUN: -fsanitize=safe-stack 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK
// CHECK-SAFESTACK: "-fsanitize=safe-stack"
+// CHECK-SAFESTACK-NOT: "{{.*[/\\]}}libclang_rt.safestack-x86_64.a"
+// CHECK-SAFESTACK-NOT: "__safestack_init"
// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
// RUN: -fsanitize=address 2>&1 \
Index: lib/Driver/SanitizerArgs.cpp
===================================================================
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -605,6 +605,11 @@
AsanUseAfterScope = false;
}
+ if (AllAddedKinds & SafeStack) {
+ // SafeStack runtime is built into the system on Fuchsia.
+ SafeStackRuntime = !TC.getTriple().isOSFuchsia();
+ }
+
// Parse -link-cxx-sanitizer flag.
LinkCXXRuntimes =
Args.hasArg(options::OPT_fsanitize_link_cxx_runtime) || D.CCCIsCXX();
Index: include/clang/Driver/SanitizerArgs.h
===================================================================
--- include/clang/Driver/SanitizerArgs.h
+++ include/clang/Driver/SanitizerArgs.h
@@ -38,6 +38,7 @@
bool AsanGlobalsDeadStripping = false;
bool LinkCXXRuntimes = false;
bool NeedPIE = false;
+ bool SafeStackRuntime = false;
bool Stats = false;
bool TsanMemoryAccess = true;
bool TsanFuncEntryExit = true;
@@ -58,9 +59,7 @@
}
bool needsUbsanRt() const;
bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); }
- bool needsSafeStackRt() const {
- return Sanitizers.has(SanitizerKind::SafeStack);
- }
+ bool needsSafeStackRt() const { return SafeStackRuntime; }
bool needsCfiRt() const;
bool needsCfiDiagRt() const;
bool needsStatsRt() const { return Stats; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36779.111301.patch
Type: text/x-patch
Size: 1884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170816/775a7131/attachment.bin>
More information about the cfe-commits
mailing list