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.
Once things have settled and this works fine in practice, the default can be switched from dwarf to SEH. Or is this unnecessary churn and we should just keep off this until the default can be changed?
Can you put this logic in the Windows or mingw toolchain instead by overriding IsUnwindTablesDefault? -fseh-exceptions feels fairly target specific.
If not, this boolean default feels fairly complicated. Here's how I would restructure it:
Basically, we have some defaults dictated by the toolchain, and then two boolean flags, where one takes precedence over the other. -fno-async by itself will disable unwind tables, but -munwind-tables -fno-asynchronous-unwind-tables will leave them enabled, despite not following the usual "last flag wins" logic.