@@ -5461,17 +5461,26 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5461
5461
// -fasynchronous-unwind-tables and -fnon-call-exceptions interact in more
5462
5462
// complicated ways.
5463
5463
auto SanitizeArgs = TC.getSanitizerArgs (Args);
5464
- bool AsyncUnwindTables = Args.hasFlag (
5465
- options::OPT_fasynchronous_unwind_tables,
5466
- options::OPT_fno_asynchronous_unwind_tables,
5467
- (TC.IsUnwindTablesDefault (Args) || SanitizeArgs.needsUnwindTables ()) &&
5468
- !Freestanding);
5469
- bool UnwindTables = Args.hasFlag (options::OPT_funwind_tables,
5470
- options::OPT_fno_unwind_tables, false );
5471
- if (AsyncUnwindTables)
5472
- CmdArgs.push_back (" -funwind-tables=2" );
5473
- else if (UnwindTables)
5464
+ auto UnwindTables = TC.getDefaultUnwindTableLevel (Args);
5465
+
5466
+ if (Args.hasFlag (options::OPT_fasynchronous_unwind_tables,
5467
+ options::OPT_fno_asynchronous_unwind_tables,
5468
+ SanitizeArgs.needsUnwindTables ()) &&
5469
+ !Freestanding)
5470
+ UnwindTables = ToolChain::UnwindTableLevel::Asynchronous;
5471
+ else if (Args.hasFlag (options::OPT_funwind_tables,
5472
+ options::OPT_fno_unwind_tables, false ))
5473
+ UnwindTables = ToolChain::UnwindTableLevel::Synchronous;
5474
+ else if (Args.hasFlag (options::OPT_fno_unwind_tables,
5475
+ options::OPT_fno_asynchronous_unwind_tables,
5476
+ options::OPT_funwind_tables, false ) || Freestanding)
5477
+ UnwindTables = ToolChain::UnwindTableLevel::None;
5478
+
5479
+
5480
+ if (UnwindTables == ToolChain::UnwindTableLevel::Synchronous)
5474
5481
CmdArgs.push_back (" -funwind-tables=1" );
5482
+ else if (UnwindTables == ToolChain::UnwindTableLevel::Asynchronous)
5483
+ CmdArgs.push_back (" -funwind-tables=2" );
5475
5484
5476
5485
// Prepare `-aux-target-cpu` and `-aux-target-feature` unless
5477
5486
// `--gpu-use-aux-triple-only` is specified.
@@ -7293,7 +7302,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
7293
7302
CmdArgs.push_back (" -faddrsig" );
7294
7303
7295
7304
if ((Triple.isOSBinFormatELF () || Triple.isOSBinFormatMachO ()) &&
7296
- (EH || AsyncUnwindTables || UnwindTables ||
7305
+ (EH || UnwindTables != ToolChain::UnwindTableLevel::None ||
7297
7306
DebugInfoKind != codegenoptions::NoDebugInfo))
7298
7307
CmdArgs.push_back (" -D__GCC_HAVE_DWARF2_CFI_ASM=1" );
7299
7308
0 commit comments