[PATCH] D62559: [WebAssembly] Support VPtr sanitizer for Emscripten
Thomas Lively via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 29 11:30:22 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362004: [WebAssembly] Support VPtr sanitizer for Emscripten (authored by tlively, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D62559?vs=201803&id=202003#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62559/new/
https://reviews.llvm.org/D62559
Files:
cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
cfe/trunk/test/CodeGenCXX/wasm-sanitize-vptr.cpp
Index: cfe/trunk/test/CodeGenCXX/wasm-sanitize-vptr.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/wasm-sanitize-vptr.cpp
+++ cfe/trunk/test/CodeGenCXX/wasm-sanitize-vptr.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -std=c++11 -fsanitize=vptr -emit-llvm %s -o - -triple wasm32-unknown-emscripten | FileCheck %s
+
+struct S {
+ virtual ~S() {}
+ int a;
+};
+
+struct T : S {
+ int b;
+};
+
+// CHECK-LABEL: @_Z15bad_static_castv
+void bad_static_cast() {
+ S s;
+ // CHECK: br i1 %[[NONNULL:.*]], label %[[CONT:.*]], label %[[MISS:.*]], !prof
+ // CHECK: [[MISS]]:
+ // CHECK: call void @__ubsan_handle_dynamic_type_cache_miss_abort
+ // CHECK: [[CONT]]:
+ T &r = static_cast<T &>(s);
+}
Index: cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
+++ cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
@@ -66,6 +66,7 @@
llvm::opt::ArgStringList &CC1Args) const override;
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
+ SanitizerMask getSupportedSanitizers() const override;
const char *getDefaultLinker() const override { return "wasm-ld"; }
Index: cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
+++ cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
@@ -208,6 +208,14 @@
}
}
+SanitizerMask WebAssembly::getSupportedSanitizers() const {
+ SanitizerMask Res = ToolChain::getSupportedSanitizers();
+ if (getTriple().isOSEmscripten()) {
+ Res |= SanitizerKind::Vptr;
+ }
+ return Res;
+}
+
Tool *WebAssembly::buildLinker() const {
return new tools::wasm::Linker(*this);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62559.202003.patch
Type: text/x-patch
Size: 1879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190529/2316cc0b/attachment-0001.bin>
More information about the cfe-commits
mailing list