[clang] fcb784d - [clang] [MinGW] Default to WinEH (SEH) exception handling instead of Dwarf

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 13:28:13 PDT 2022


Author: Martin Storsjö
Date: 2022-06-06T23:27:31+03:00
New Revision: fcb784db496137fa29a11b7e106efe89c7550e11

URL: https://github.com/llvm/llvm-project/commit/fcb784db496137fa29a11b7e106efe89c7550e11
DIFF: https://github.com/llvm/llvm-project/commit/fcb784db496137fa29a11b7e106efe89c7550e11.diff

LOG: [clang] [MinGW] Default to WinEH (SEH) exception handling instead of Dwarf

The relevant runtime libraries have been updated to support this
now.

Differential Revision: https://reviews.llvm.org/D126871

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/MinGW.cpp
    clang/test/Driver/windows-exceptions.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
index ceeaa79bc2021..43466ef2b40f5 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -478,8 +478,8 @@ bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const {
   if (ExceptionArg &&
       ExceptionArg->getOption().matches(options::OPT_fseh_exceptions))
     return true;
-  return getArch() == llvm::Triple::x86_64 ||
-         getArch() == llvm::Triple::aarch64;
+  return getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::arm ||
+         getArch() == llvm::Triple::thumb || getArch() == llvm::Triple::aarch64;
 }
 
 bool toolchains::MinGW::isPICDefault() const {
@@ -495,7 +495,8 @@ bool toolchains::MinGW::isPICDefaultForced() const { return true; }
 
 llvm::ExceptionHandling
 toolchains::MinGW::GetExceptionModel(const ArgList &Args) const {
-  if (getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::aarch64)
+  if (getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::aarch64 ||
+      getArch() == llvm::Triple::arm || getArch() == llvm::Triple::thumb)
     return llvm::ExceptionHandling::WinEH;
   return llvm::ExceptionHandling::DwarfCFI;
 }

diff  --git a/clang/test/Driver/windows-exceptions.cpp b/clang/test/Driver/windows-exceptions.cpp
index 244c3b9479549..ffca80fdfa550 100644
--- a/clang/test/Driver/windows-exceptions.cpp
+++ b/clang/test/Driver/windows-exceptions.cpp
@@ -4,6 +4,8 @@
 // RUN: %clang -target aarch64-windows-msvc -c %s -### 2>&1 | FileCheck -check-prefix=MSVC -check-prefix=MSVC-SEH %s
 // RUN: %clang -target i686-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s
 // RUN: %clang -target x86_64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s
+// RUN: %clang -target armv7-windows-gnu -fdwarf-exceptions -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s
+// RUN: %clang -target armv7-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s
 // RUN: %clang -target aarch64-windows-gnu -fdwarf-exceptions -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s
 // RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s
 


        


More information about the cfe-commits mailing list