aboutsummaryrefslogtreecommitdiff
path: root/src/Package/Module.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-01-23 01:38:20 +0100
committermlugg <mlugg@mlugg.co.uk>2025-01-23 23:22:38 +0000
commitef4d7f01a5c26d8ed6fa8236d1b64e4091a51be3 (patch)
tree80da7b2ae3a66a5e394d31ccd62421529a14929b /src/Package/Module.zig
parentb46a40ff1db6c4d467925a9a0d72436cdb3a6a74 (diff)
downloadzig-ef4d7f01a5c26d8ed6fa8236d1b64e4091a51be3.tar.gz
zig-ef4d7f01a5c26d8ed6fa8236d1b64e4091a51be3.zip
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.
Diffstat (limited to 'src/Package/Module.zig')
-rw-r--r--src/Package/Module.zig16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Package/Module.zig b/src/Package/Module.zig
index 433a9b6ade..62b7f075dd 100644
--- a/src/Package/Module.zig
+++ b/src/Package/Module.zig
@@ -112,7 +112,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
if (options.inherited.sanitize_thread == true) assert(options.global.any_sanitize_thread);
if (options.inherited.fuzz == true) assert(options.global.any_fuzz);
if (options.inherited.single_threaded == false) assert(options.global.any_non_single_threaded);
- if (options.inherited.unwind_tables) |uwt| if (uwt != .none) assert(options.global.any_unwind_tables != .none);
+ if (options.inherited.unwind_tables) |uwt| if (uwt != .none) assert(options.global.any_unwind_tables);
if (options.inherited.error_tracing == true) assert(options.global.any_error_tracing);
const resolved_target = options.inherited.resolved_target orelse options.parent.?.resolved_target;
@@ -121,9 +121,6 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
const optimize_mode = options.inherited.optimize_mode orelse
if (options.parent) |p| p.optimize_mode else .Debug;
- const unwind_tables = options.inherited.unwind_tables orelse
- if (options.parent) |p| p.unwind_tables else options.global.any_unwind_tables;
-
const strip = b: {
if (options.inherited.strip) |x| break :b x;
if (options.parent) |p| break :b p.strip;
@@ -220,6 +217,17 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
break :b false;
};
+ const unwind_tables = b: {
+ if (options.inherited.unwind_tables) |x| break :b x;
+ if (options.parent) |p| break :b p.unwind_tables;
+
+ break :b target_util.defaultUnwindTables(
+ target,
+ options.global.link_libunwind,
+ sanitize_thread or options.global.any_sanitize_thread,
+ );
+ };
+
const fuzz = b: {
if (options.inherited.fuzz) |x| break :b x;
if (options.parent) |p| break :b p.fuzz;