Skip to content

Commit

Permalink
[clang] [MinGW] Default to WinEH (SEH) exception handling instead of …
Browse files Browse the repository at this point in the history
…Dwarf

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

Differential Revision: https://reviews.llvm.org/D126871
  • Loading branch information
mstorsjo committed Jun 6, 2022
1 parent 98dc3e8 commit fcb784d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions clang/lib/Driver/ToolChains/MinGW.cpp
Expand Up @@ -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 {
Expand All @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/windows-exceptions.cpp
Expand Up @@ -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

Expand Down

0 comments on commit fcb784d

Please sign in to comment.