From ef4d7f01a5c26d8ed6fa8236d1b64e4091a51be3 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Thu, 23 Jan 2025 01:38:20 +0100 Subject: compiler: Fix computation of Compilation.Config.any_unwind_tables. This moves the default value logic to Package.Module.create() instead and makes it so that Compilation.Config.any_unwind_tables is computed similarly to any_sanitize_thread, any_fuzz, etc. It turns out that for any_unwind_tables, we only actually care if unwind tables are enabled at all, not at what level. --- src/Compilation.zig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index ac8fb8a59b..81d95df9ef 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1274,15 +1274,12 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil // The "any" values provided by resolved config only account for // explicitly-provided settings. We now make them additionally account // for default setting resolution. - const any_unwind_tables = switch (options.config.any_unwind_tables) { - .none => options.root_mod.unwind_tables, - .sync, .@"async" => |uwt| uwt, - }; + const any_unwind_tables = options.config.any_unwind_tables or options.root_mod.unwind_tables != .none; const any_non_single_threaded = options.config.any_non_single_threaded or !options.root_mod.single_threaded; const any_sanitize_thread = options.config.any_sanitize_thread or options.root_mod.sanitize_thread; const any_fuzz = options.config.any_fuzz or options.root_mod.fuzz; - const link_eh_frame_hdr = options.link_eh_frame_hdr or any_unwind_tables != .none; + const link_eh_frame_hdr = options.link_eh_frame_hdr or any_unwind_tables; const build_id = options.build_id orelse .none; const link_libc = options.config.link_libc; @@ -6459,6 +6456,7 @@ fn buildOutputFromZig( .root_optimize_mode = optimize_mode, .root_strip = strip, .link_libc = comp.config.link_libc, + .any_unwind_tables = comp.root_mod.unwind_tables != .none, }); const root_mod = try Package.Module.create(arena, .{ @@ -6595,6 +6593,7 @@ pub fn build_crt_file( .root_optimize_mode = comp.compilerRtOptMode(), .root_strip = comp.compilerRtStrip(), .link_libc = false, + .any_unwind_tables = options.unwind_tables != .none, .lto = switch (output_mode) { .Lib => comp.config.lto, .Obj, .Exe => .none, -- cgit v1.2.3