Index: lib/Driver/ToolChains/MinGW.cpp =================================================================== --- lib/Driver/ToolChains/MinGW.cpp +++ lib/Driver/ToolChains/MinGW.cpp @@ -429,6 +429,12 @@ } bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { + Arg *ExceptionArg = Args.getLastArg(options::OPT_fsjlj_exceptions, + options::OPT_fseh_exceptions, + options::OPT_fdwarf_exceptions); + if (ExceptionArg && + ExceptionArg->getOption().matches(options::OPT_fseh_exceptions)) + return true; return getArch() == llvm::Triple::x86_64; } Index: test/Driver/windows-exceptions.cpp =================================================================== --- test/Driver/windows-exceptions.cpp +++ test/Driver/windows-exceptions.cpp @@ -2,8 +2,11 @@ // RUN: %clang -target x86_64-windows-msvc -c %s -### 2>&1 | FileCheck -check-prefix=MSVC %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 aarch64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s +// RUN: %clang -target aarch64-windows-gnu -fseh-exceptions -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s MSVC-NOT: -fdwarf-exceptions MSVC-NOT: -fseh-exceptions MINGW-DWARF: -fdwarf-exceptions +MINGW-SEH: -munwind-tables MINGW-SEH: -fseh-exceptions