r349452 - [Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 00:36:10 PST 2018


Author: mstorsjo
Date: Tue Dec 18 00:36:10 2018
New Revision: 349452

URL: http://llvm.org/viewvc/llvm-project?rev=349452&view=rev
Log:
[Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled

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

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

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=349452&r1=349451&r2=349452&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Dec 18 00:36:10 2018
@@ -429,6 +429,12 @@ bool toolchains::MinGW::HasNativeLLVMSup
 }
 
 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;
 }
 

Modified: cfe/trunk/test/Driver/windows-exceptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-exceptions.cpp?rev=349452&r1=349451&r2=349452&view=diff
==============================================================================
--- cfe/trunk/test/Driver/windows-exceptions.cpp (original)
+++ cfe/trunk/test/Driver/windows-exceptions.cpp Tue Dec 18 00:36:10 2018
@@ -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




More information about the cfe-commits mailing list