Skip to content

Commit

Permalink
Define Contiki OS toolchain
Browse files Browse the repository at this point in the history
Patch by Michael LeMay

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

llvm-svn: 284278
  • Loading branch information
David L Kreitzer committed Oct 14, 2016
1 parent c37a498 commit d397ea4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/Driver/Driver.cpp
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions clang/lib/Driver/ToolChains.cpp
Expand Up @@ -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;
}
8 changes: 8 additions & 0 deletions clang/lib/Driver/ToolChains.h
Expand Up @@ -1249,6 +1249,14 @@ class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
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
Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/fsanitize.c
Expand Up @@ -397,6 +397,7 @@
// 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"
Expand Down

0 comments on commit d397ea4

Please sign in to comment.