diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-08-11 01:47:32 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-08-11 01:47:32 +0000 |
commit | 4af01079ce2f2d2528d72b8ce5be018f68ea7d73 (patch) | |
tree | 8187be79ab2ef4533f8c88d43649470b97ba7ed6 /lib | |
parent | 13722d89229f5766535e66bdb82fd876f8ac1c2c (diff) |
Merging r310006:
------------------------------------------------------------------------
r310006 | ahatanak | 2017-08-03 16:55:42 -0700 (Thu, 03 Aug 2017) | 22 lines
[Driver][Darwin] Pass -munwind-table when !UseSjLjExceptions.
This commit fixes a bug where clang/llvm doesn't emit an unwind table
for a function when it is marked noexcept. Without this patch, the
following code terminates with an uncaught exception on ARM64:
int foo1() noexcept {
try {
throw 0;
} catch (int i) {
return 0;
}
return 1;
}
int main() {
return foo1();
}
rdar://problem/32411865
Differential Revision: https://reviews.llvm.org/D35693
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@310677 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/ToolChain.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Clang.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/CrossWindows.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/CrossWindows.h | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Darwin.cpp | 4 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Darwin.h | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Gnu.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/Gnu.h | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/MSVC.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/MSVC.h | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/MinGW.cpp | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/MinGW.h | 2 | ||||
-rw-r--r-- | lib/Driver/ToolChains/NetBSD.h | 5 |
13 files changed, 17 insertions, 14 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index 2be7f0f690..9a858df8ab 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -217,7 +217,7 @@ StringRef ToolChain::getDefaultUniversalArchName() const { } } -bool ToolChain::IsUnwindTablesDefault() const { +bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { return false; } diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index b82cc2d4fa..baf7a93d2d 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -2538,7 +2538,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, bool AsynchronousUnwindTables = Args.hasFlag(options::OPT_fasynchronous_unwind_tables, options::OPT_fno_asynchronous_unwind_tables, - (getToolChain().IsUnwindTablesDefault() || + (getToolChain().IsUnwindTablesDefault(Args) || getToolChain().getSanitizerArgs().needsUnwindTables()) && !KernelOrKext); if (Args.hasFlag(options::OPT_funwind_tables, options::OPT_fno_unwind_tables, diff --git a/lib/Driver/ToolChains/CrossWindows.cpp b/lib/Driver/ToolChains/CrossWindows.cpp index 7d0c438b13..04b71c48cd 100644 --- a/lib/Driver/ToolChains/CrossWindows.cpp +++ b/lib/Driver/ToolChains/CrossWindows.cpp @@ -214,7 +214,7 @@ CrossWindowsToolChain::CrossWindowsToolChain(const Driver &D, } } -bool CrossWindowsToolChain::IsUnwindTablesDefault() const { +bool CrossWindowsToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // FIXME: all non-x86 targets need unwind tables, however, LLVM currently does // not know how to emit them. return getArch() == llvm::Triple::x86_64; diff --git a/lib/Driver/ToolChains/CrossWindows.h b/lib/Driver/ToolChains/CrossWindows.h index 5375a6324a..2f66446ec7 100644 --- a/lib/Driver/ToolChains/CrossWindows.h +++ b/lib/Driver/ToolChains/CrossWindows.h @@ -56,7 +56,7 @@ public: const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index ad8e9eae79..6b7f0c71df 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -1836,8 +1836,8 @@ Darwin::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, return DAL; } -bool MachO::IsUnwindTablesDefault() const { - return getArch() == llvm::Triple::x86_64; +bool MachO::IsUnwindTablesDefault(const ArgList &Args) const { + return !UseSjLjExceptions(Args); } bool MachO::UseDwarfDebugFlags() const { diff --git a/lib/Driver/ToolChains/Darwin.h b/lib/Driver/ToolChains/Darwin.h index 6cb1d04b78..77c569e8f8 100644 --- a/lib/Driver/ToolChains/Darwin.h +++ b/lib/Driver/ToolChains/Darwin.h @@ -216,7 +216,7 @@ public: bool UseObjCMixedDispatch() const override { return true; } - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; RuntimeLibType GetDefaultRuntimeLibType() const override { return ToolChain::RLT_CompilerRT; diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp index bc26ee1de4..72a9f85ba3 100644 --- a/lib/Driver/ToolChains/Gnu.cpp +++ b/lib/Driver/ToolChains/Gnu.cpp @@ -2291,7 +2291,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const { CudaInstallation.print(OS); } -bool Generic_GCC::IsUnwindTablesDefault() const { +bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h index cdf6100544..f29342b95a 100644 --- a/lib/Driver/ToolChains/Gnu.h +++ b/lib/Driver/ToolChains/Gnu.h @@ -284,7 +284,7 @@ public: void printVerboseInfo(raw_ostream &OS) const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/MSVC.cpp b/lib/Driver/ToolChains/MSVC.cpp index 9e9d943610..b871c856d2 100644 --- a/lib/Driver/ToolChains/MSVC.cpp +++ b/lib/Driver/ToolChains/MSVC.cpp @@ -699,7 +699,7 @@ bool MSVCToolChain::IsIntegratedAssemblerDefault() const { return true; } -bool MSVCToolChain::IsUnwindTablesDefault() const { +bool MSVCToolChain::IsUnwindTablesDefault(const ArgList &Args) const { // Emit unwind tables by default on Win64. All non-x86_32 Windows platforms // such as ARM and PPC actually require unwind tables, but LLVM doesn't know // how to generate them yet. diff --git a/lib/Driver/ToolChains/MSVC.h b/lib/Driver/ToolChains/MSVC.h index 055830c52e..d153691a5c 100644 --- a/lib/Driver/ToolChains/MSVC.h +++ b/lib/Driver/ToolChains/MSVC.h @@ -73,7 +73,7 @@ public: Action::OffloadKind DeviceOffloadKind) const override; bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/MinGW.cpp b/lib/Driver/ToolChains/MinGW.cpp index 7550bab486..632b76d92b 100644 --- a/lib/Driver/ToolChains/MinGW.cpp +++ b/lib/Driver/ToolChains/MinGW.cpp @@ -347,7 +347,7 @@ Tool *toolchains::MinGW::buildLinker() const { return new tools::MinGW::Linker(*this); } -bool toolchains::MinGW::IsUnwindTablesDefault() const { +bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } diff --git a/lib/Driver/ToolChains/MinGW.h b/lib/Driver/ToolChains/MinGW.h index cf1628a4cc..9b3d7c553f 100644 --- a/lib/Driver/ToolChains/MinGW.h +++ b/lib/Driver/ToolChains/MinGW.h @@ -60,7 +60,7 @@ public: const llvm::opt::ArgList &Args); bool IsIntegratedAssemblerDefault() const override; - bool IsUnwindTablesDefault() const override; + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; bool isPIEDefault() const override; bool isPICDefaultForced() const override; diff --git a/lib/Driver/ToolChains/NetBSD.h b/lib/Driver/ToolChains/NetBSD.h index 412d0815e8..5163ff72d8 100644 --- a/lib/Driver/ToolChains/NetBSD.h +++ b/lib/Driver/ToolChains/NetBSD.h @@ -65,7 +65,10 @@ public: const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - bool IsUnwindTablesDefault() const override { return true; } + bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override { + return true; + } + SanitizerMask getSupportedSanitizers() const override; protected: |