summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains
diff options
context:
space:
mode:
authorMartell Malone <martellmalone@gmail.com>2017-11-29 06:51:27 +0000
committerMartell Malone <martellmalone@gmail.com>2017-11-29 06:51:27 +0000
commite9d94f5b6cbfe39e131add4af58a899180a7102c (patch)
tree3f7265f5a0f293173ab388fefad3a8a11e586256 /lib/Driver/ToolChains
parente7eb264ed0f3672350242daa351da0a2385bb762 (diff)
Revert "Toolchain: Normalize dwarf, sjlj and seh eh"
This reverts rL319294. The windows sanitizer does not like seh on x86. Will re apply with None type for x86 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319295 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains')
-rw-r--r--lib/Driver/ToolChains/Clang.cpp30
-rw-r--r--lib/Driver/ToolChains/Darwin.cpp11
-rw-r--r--lib/Driver/ToolChains/Darwin.h8
-rw-r--r--lib/Driver/ToolChains/FreeBSD.cpp12
-rw-r--r--lib/Driver/ToolChains/FreeBSD.h3
-rw-r--r--lib/Driver/ToolChains/MinGW.cpp7
-rw-r--r--lib/Driver/ToolChains/MinGW.h4
-rw-r--r--lib/Driver/ToolChains/NetBSD.cpp8
-rw-r--r--lib/Driver/ToolChains/NetBSD.h3
9 files changed, 20 insertions, 66 deletions
diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp
index 1c90c6e922..d96664cf0b 100644
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -4166,33 +4166,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, Runtime,
CmdArgs);
- // Handle exception personalities
- Arg *A = Args.getLastArg(options::OPT_fsjlj_exceptions,
- options::OPT_fseh_exceptions,
- options::OPT_fdwarf_exceptions);
- if (A) {
- const Option &Opt = A->getOption();
- if (Opt.matches(options::OPT_fsjlj_exceptions))
- CmdArgs.push_back("-fsjlj-exceptions");
- if (Opt.matches(options::OPT_fseh_exceptions))
- CmdArgs.push_back("-fseh-exceptions");
- if (Opt.matches(options::OPT_fdwarf_exceptions))
- CmdArgs.push_back("-fdwarf-exceptions");
- } else {
- switch(getToolChain().GetExceptionModel(Args)) {
- default:
- break;
- case llvm::ExceptionHandling::DwarfCFI:
- CmdArgs.push_back("-fdwarf-exceptions");
- break;
- case llvm::ExceptionHandling::SjLj:
- CmdArgs.push_back("-fsjlj-exceptions");
- break;
- case llvm::ExceptionHandling::WinEH:
- CmdArgs.push_back("-fseh-exceptions");
- break;
- }
- }
+ if (Args.hasArg(options::OPT_fsjlj_exceptions) ||
+ getToolChain().UseSjLjExceptions(Args))
+ CmdArgs.push_back("-fsjlj-exceptions");
// C++ "sane" operator new.
if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp
index 7c401aa9dd..5dc8a91bcf 100644
--- a/lib/Driver/ToolChains/Darwin.cpp
+++ b/lib/Driver/ToolChains/Darwin.cpp
@@ -1881,7 +1881,7 @@ bool MachO::IsUnwindTablesDefault(const ArgList &Args) const {
// Unwind tables are not emitted if -fno-exceptions is supplied (except when
// targeting x86_64).
return getArch() == llvm::Triple::x86_64 ||
- (GetExceptionModel(Args) != llvm::ExceptionHandling::SjLj &&
+ (!UseSjLjExceptions(Args) &&
Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
true));
}
@@ -1892,18 +1892,15 @@ bool MachO::UseDwarfDebugFlags() const {
return false;
}
-llvm::ExceptionHandling Darwin::GetExceptionModel(const ArgList &Args) const {
+bool Darwin::UseSjLjExceptions(const ArgList &Args) const {
// Darwin uses SjLj exceptions on ARM.
if (getTriple().getArch() != llvm::Triple::arm &&
getTriple().getArch() != llvm::Triple::thumb)
- return llvm::ExceptionHandling::None;
+ return false;
// Only watchOS uses the new DWARF/Compact unwinding method.
llvm::Triple Triple(ComputeLLVMTriple(Args));
- if(Triple.isWatchABI())
- return llvm::ExceptionHandling::DwarfCFI;
-
- return llvm::ExceptionHandling::SjLj;
+ return !Triple.isWatchABI();
}
bool Darwin::SupportsEmbeddedBitcode() const {
diff --git a/lib/Driver/ToolChains/Darwin.h b/lib/Driver/ToolChains/Darwin.h
index c861f172fe..2b8477aa27 100644
--- a/lib/Driver/ToolChains/Darwin.h
+++ b/lib/Driver/ToolChains/Darwin.h
@@ -247,9 +247,8 @@ public:
bool UseDwarfDebugFlags() const override;
- llvm::ExceptionHandling
- GetExceptionModel(const llvm::opt::ArgList &Args) const override {
- return llvm::ExceptionHandling::None;
+ bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override {
+ return false;
}
/// }
@@ -456,8 +455,7 @@ public:
void CheckObjCARC() const override;
- llvm::ExceptionHandling GetExceptionModel(
- const llvm::opt::ArgList &Args) const override;
+ bool UseSjLjExceptions(const llvm::opt::ArgList &Args) const override;
bool SupportsEmbeddedBitcode() const override;
diff --git a/lib/Driver/ToolChains/FreeBSD.cpp b/lib/Driver/ToolChains/FreeBSD.cpp
index 025acf1511..2f066cf0cc 100644
--- a/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/lib/Driver/ToolChains/FreeBSD.cpp
@@ -359,17 +359,17 @@ Tool *FreeBSD::buildAssembler() const {
Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
-llvm::ExceptionHandling FreeBSD::GetExceptionModel(const ArgList &Args) const {
+bool FreeBSD::UseSjLjExceptions(const ArgList &Args) const {
// FreeBSD uses SjLj exceptions on ARM oabi.
switch (getTriple().getEnvironment()) {
- default:
- if (getTriple().getArch() == llvm::Triple::arm ||
- getTriple().getArch() == llvm::Triple::thumb)
- return llvm::ExceptionHandling::SjLj;
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABI:
case llvm::Triple::EABI:
- return llvm::ExceptionHandling::None;
+ return false;
+
+ default:
+ return (getTriple().getArch() == llvm::Triple::arm ||
+ getTriple().getArch() == llvm::Triple::thumb);
}
}
diff --git a/lib/Driver/ToolChains/FreeBSD.h b/lib/Driver/ToolChains/FreeBSD.h
index 2943e1cacf..25e9df72bc 100644
--- a/lib/Driver/ToolChains/FreeBSD.h
+++ b/lib/Driver/ToolChains/FreeBSD.h
@@ -66,8 +66,7 @@ public:
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
- llvm::ExceptionHandling GetExceptionModel(
- const llvm::opt::ArgList &Args) 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/lib/Driver/ToolChains/MinGW.cpp b/lib/Driver/ToolChains/MinGW.cpp
index 572ea803f2..79864eab83 100644
--- a/lib/Driver/ToolChains/MinGW.cpp
+++ b/lib/Driver/ToolChains/MinGW.cpp
@@ -367,11 +367,8 @@ bool toolchains::MinGW::isPICDefaultForced() const {
return getArch() == llvm::Triple::x86_64;
}
-llvm::ExceptionHandling
-toolchains::MinGW::GetExceptionModel(const ArgList &Args) const {
- if (getArch() == llvm::Triple::x86_64)
- return llvm::ExceptionHandling::WinEH;
- return llvm::ExceptionHandling::DwarfCFI;
+bool toolchains::MinGW::UseSEHExceptions() const {
+ return getArch() == llvm::Triple::x86_64;
}
void toolchains::MinGW::AddCudaIncludeArgs(const ArgList &DriverArgs,
diff --git a/lib/Driver/ToolChains/MinGW.h b/lib/Driver/ToolChains/MinGW.h
index f8dbcae627..9b3d7c553f 100644
--- a/lib/Driver/ToolChains/MinGW.h
+++ b/lib/Driver/ToolChains/MinGW.h
@@ -64,9 +64,7 @@ public:
bool isPICDefault() const override;
bool isPIEDefault() const override;
bool isPICDefaultForced() const override;
-
- llvm::ExceptionHandling GetExceptionModel(
- const llvm::opt::ArgList &Args) const override;
+ bool UseSEHExceptions() const;
void
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
diff --git a/lib/Driver/ToolChains/NetBSD.cpp b/lib/Driver/ToolChains/NetBSD.cpp
index c0a0808b37..85bb69cfda 100644
--- a/lib/Driver/ToolChains/NetBSD.cpp
+++ b/lib/Driver/ToolChains/NetBSD.cpp
@@ -416,14 +416,6 @@ void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
"", DriverArgs, CC1Args);
}
-llvm::ExceptionHandling NetBSD::GetExceptionModel(const ArgList &Args) const {
- // NetBSD uses Dwarf exceptions on ARM.
- if (getTriple().getArch() == llvm::Triple::arm ||
- getTriple().getArch() == llvm::Triple::thumb)
- return llvm::ExceptionHandling::DwarfCFI;
- return llvm::ExceptionHandling::None;
-}
-
SanitizerMask NetBSD::getSupportedSanitizers() const {
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
diff --git a/lib/Driver/ToolChains/NetBSD.h b/lib/Driver/ToolChains/NetBSD.h
index e98df72ce6..5163ff72d8 100644
--- a/lib/Driver/ToolChains/NetBSD.h
+++ b/lib/Driver/ToolChains/NetBSD.h
@@ -69,9 +69,6 @@ public:
return true;
}
- llvm::ExceptionHandling GetExceptionModel(
- const llvm::opt::ArgList &Args) const override;
-
SanitizerMask getSupportedSanitizers() const override;
protected: