]> granicus.if.org Git - clang/commitdiff
Define Contiki OS toolchain
authorDavid L Kreitzer <david.l.kreitzer@intel.com>
Fri, 14 Oct 2016 20:44:33 +0000 (20:44 +0000)
committerDavid L Kreitzer <david.l.kreitzer@intel.com>
Fri, 14 Oct 2016 20:44:33 +0000 (20:44 +0000)
Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D19854

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284278 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h
test/Driver/fsanitize.c

index 459f601814b9f0171fc355dbf35c7578b3e0d3cd..f2ee1ca5c80a815fb19b467def978aad19ea19f3 100644 (file)
@@ -3120,6 +3120,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
     case llvm::Triple::PS4:
       TC = new toolchains::PS4CPU(*this, Target, Args);
       break;
+    case llvm::Triple::Contiki:
+      TC = new toolchains::Contiki(*this, Target, Args);
+      break;
     default:
       // Of these targets, Hexagon is the only one that might have
       // an OS of Linux, in which case it got handled above already.
index e71aaf36cf5d1d68e4f17ceb3eb75c153a117dfe..93beab836138bf993f4522dd1013ea7bc485c906 100644 (file)
@@ -5305,3 +5305,14 @@ SanitizerMask PS4CPU::getSupportedSanitizers() const {
   Res |= SanitizerKind::Vptr;
   return Res;
 }
+
+Contiki::Contiki(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+    : Generic_ELF(D, Triple, Args) {}
+
+SanitizerMask Contiki::getSupportedSanitizers() const {
+  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  if (IsX86)
+    Res |= SanitizerKind::SafeStack;
+  return Res;
+}
index 36773b21818860ae3b1f3aaadcb758988fc40ec2..0838208e3be0620b863060911a59b8c186e59e2f 100644 (file)
@@ -1249,6 +1249,14 @@ protected:
   Tool *buildLinker() const override;
 };
 
+class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF {
+public:
+  Contiki(const Driver &D, const llvm::Triple &Triple,
+          const llvm::opt::ArgList &Args);
+
+  SanitizerMask getSupportedSanitizers() const override;
+};
+
 } // end namespace toolchains
 } // end namespace driver
 } // end namespace clang
index 1f6664bb080d84af4d636823ec04f6d34fa70e7d..870a26268d553038f2c34bb82c1191a183e87429 100644 (file)
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
 // SP: "-fsanitize=safe-stack"