summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2015-10-30 16:30:41 +0000
committerTim Northover <tnorthover@apple.com>2015-10-30 16:30:41 +0000
commite931f9fc0dcfeb51421b9a0faa7039bb4f9f53a7 (patch)
treea4cbf5ad544cd614d39dc59721b59375f0f9c183 /clang
parent756447a67c39ba1e95cb5c92cbeb06f8a795b7fb (diff)
downloadbcm5719-llvm-e931f9fc0dcfeb51421b9a0faa7039bb4f9f53a7.tar.gz
bcm5719-llvm-e931f9fc0dcfeb51421b9a0faa7039bb4f9f53a7.zip
Disable SjLj exceptions for watchOS
llvm-svn: 251709
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Driver/ToolChain.h4
-rw-r--r--clang/lib/Driver/ToolChains.cpp16
-rw-r--r--clang/lib/Driver/ToolChains.h8
-rw-r--r--clang/lib/Driver/Tools.cpp2
-rw-r--r--clang/test/Driver/arch-armv7k.c1
5 files changed, 22 insertions, 9 deletions
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index edbf56200f3..58e7c724cd0 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -304,7 +304,9 @@ public:
virtual bool GetDefaultStandaloneDebug() const { return false; }
/// UseSjLjExceptions - Does this tool chain use SjLj exceptions.
- virtual bool UseSjLjExceptions() const { return false; }
+ virtual bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const {
+ return false;
+ }
/// getThreadModel() - Which thread model does this target use?
virtual std::string getThreadModel() const { return "posix"; }
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index b65c5c13608..43a8ff657dd 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -1037,10 +1037,18 @@ bool MachO::UseDwarfDebugFlags() const {
return false;
}
-bool Darwin::UseSjLjExceptions() const {
+bool Darwin::UseSjLjExceptions(const ArgList &Args) const {
// Darwin uses SjLj exceptions on ARM.
- return (getTriple().getArch() == llvm::Triple::arm ||
- getTriple().getArch() == llvm::Triple::thumb);
+ if (getTriple().getArch() != llvm::Triple::arm &&
+ getTriple().getArch() != llvm::Triple::thumb)
+ return false;
+
+ // We can't check directly for watchOS here. ComputeLLVMTriple only
+ // fills in the ArchName correctly.
+ llvm::Triple Triple(ComputeLLVMTriple(Args));
+ return !(Triple.getArchName() == "armv7k" ||
+ Triple.getArchName() == "thumbv7k");
+
}
bool MachO::isPICDefault() const { return true; }
@@ -2952,7 +2960,7 @@ Tool *FreeBSD::buildAssembler() const {
Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
-bool FreeBSD::UseSjLjExceptions() const {
+bool FreeBSD::UseSjLjExceptions(const ArgList &Args) const {
// FreeBSD uses SjLj exceptions on ARM oabi.
switch (getTriple().getEnvironment()) {
case llvm::Triple::GNUEABIHF:
diff --git a/clang/lib/Driver/ToolChains.h b/clang/lib/Driver/ToolChains.h
index d88403239fb..77433789f95 100644
--- a/clang/lib/Driver/ToolChains.h
+++ b/clang/lib/Driver/ToolChains.h
@@ -339,7 +339,9 @@ public:
bool UseDwarfDebugFlags() const override;
- bool UseSjLjExceptions() const override { return false; }
+ bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override {
+ return false;
+ }
/// }
};
@@ -528,7 +530,7 @@ public:
void CheckObjCARC() const override;
- bool UseSjLjExceptions() const override;
+ bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
SanitizerMask getSupportedSanitizers() const override;
};
@@ -714,7 +716,7 @@ public:
const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
- bool UseSjLjExceptions() const override;
+ bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
bool isPIEDefault() const override;
SanitizerMask getSupportedSanitizers() const override;
unsigned GetDefaultDwarfVersion() const override { return 2; }
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 42a168584cd..e72e4bdcb22 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -4824,7 +4824,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, objcRuntime,
CmdArgs);
- if (getToolChain().UseSjLjExceptions())
+ if (getToolChain().UseSjLjExceptions(Args))
CmdArgs.push_back("-fsjlj-exceptions");
// C++ "sane" operator new.
diff --git a/clang/test/Driver/arch-armv7k.c b/clang/test/Driver/arch-armv7k.c
index 7f5923e7ddb..190d8999ab6 100644
--- a/clang/test/Driver/arch-armv7k.c
+++ b/clang/test/Driver/arch-armv7k.c
@@ -2,3 +2,4 @@
// RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -c %s -### 2>&1 | FileCheck %s
// CHECK: "-cc1"{{.*}} "-target-cpu" "cortex-a7"
+// CHECK-NOT: "-fsjlj-exceptions"
OpenPOWER on IntegriCloud