]> granicus.if.org Git - clang/commitdiff
[Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled
authorMartin Storsjo <martin@martin.st>
Tue, 18 Dec 2018 08:36:10 +0000 (08:36 +0000)
committerMartin Storsjo <martin@martin.st>
Tue, 18 Dec 2018 08:36:10 +0000 (08:36 +0000)
For targets where SEH exceptions are used by default (on MinGW,
only x86_64 so far), -munwind-tables are added automatically. If
-fseh-exeptions is enabled on a target where SEH exeptions are
availble but not enabled by default yet (aarch64), we need to
pass -munwind-tables if -fseh-exceptions was specified.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349452 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/MinGW.cpp
test/Driver/windows-exceptions.cpp

index 836d7c155102ea055407d671a5bec7602b994cdd..2d5217d03d3a4779cc3e2212b1c1a52467cf42cc 100644 (file)
@@ -429,6 +429,12 @@ bool toolchains::MinGW::HasNativeLLVMSupport() const {
 }
 
 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 8bce3b8dd82f2a8788c3cb6721f090682d0ce027..2eefe22bcdbfad18d2fcee151ec498f09f36f6b2 100644 (file)
@@ -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