[Driver] Enable CFI for WebAssembly
authorDerek Schuff <dschuff@google.com>
Mon, 8 Aug 2016 21:14:15 +0000 (21:14 +0000)
committerDerek Schuff <dschuff@google.com>
Mon, 8 Aug 2016 21:14:15 +0000 (21:14 +0000)
Since CFI support has landed in the WebAssembly backend, enable it in
the frontend driver.

Patch by Dominic Chen

Differential Revision: https://reviews.llvm.org/D23244

llvm-svn: 278051

clang/lib/Driver/ToolChain.cpp

index 58afaed..863bd0a 100644 (file)
@@ -697,7 +697,9 @@ SanitizerMask ToolChain::getSupportedSanitizers() const {
   SanitizerMask Res = (Undefined & ~Vptr & ~Function) | (CFI & ~CFIICall) |
                       CFICastStrict | UnsignedIntegerOverflow | LocalBounds;
   if (getTriple().getArch() == llvm::Triple::x86 ||
-      getTriple().getArch() == llvm::Triple::x86_64)
+      getTriple().getArch() == llvm::Triple::x86_64 ||
+      getTriple().getArch() == llvm::Triple::wasm32 ||
+      getTriple().getArch() == llvm::Triple::wasm64)
     Res |= CFIICall;
   return Res;
 }