diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-01-23 01:38:20 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-01-23 23:22:38 +0000 |
| commit | ef4d7f01a5c26d8ed6fa8236d1b64e4091a51be3 (patch) | |
| tree | 80da7b2ae3a66a5e394d31ccd62421529a14929b /src/Compilation | |
| parent | b46a40ff1db6c4d467925a9a0d72436cdb3a6a74 (diff) | |
| download | zig-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/Compilation')
| -rw-r--r-- | src/Compilation/Config.zig | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index e91055709c..c6ded8cfb2 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -12,14 +12,13 @@ link_libunwind: bool, /// True if and only if the c_source_files field will have nonzero length when /// calling Compilation.create. any_c_source_files: bool, -/// This is not `.none` if any `Module` has `unwind_tables` set explicitly to a +/// This is `true` if any `Module` has `unwind_tables` set explicitly to a /// value other than `.none`. Until `Compilation.create()` is called, it is -/// possible for this to be `.none` while in fact all `Module` instances have +/// possible for this to be `false` while in fact all `Module` instances have /// `unwind_tables != .none` due to the default. After `Compilation.create()` is /// called, this will also take into account the default setting, making this -/// value `.sync` or `.@"async"` if and only if any `Module` has -/// `unwind_tables != .none`. -any_unwind_tables: std.builtin.UnwindTables, +/// value `true` if and only if any `Module` has `unwind_tables != .none`. +any_unwind_tables: bool, /// This is true if any Module has single_threaded set explicitly to false. Until /// Compilation.create is called, it is possible for this to be false while in /// fact all Module instances have single_threaded=false due to the default @@ -88,7 +87,7 @@ pub const Options = struct { any_non_single_threaded: bool = false, any_sanitize_thread: bool = false, any_fuzz: bool = false, - any_unwind_tables: std.builtin.UnwindTables = .none, + any_unwind_tables: bool = false, any_dyn_libs: bool = false, any_c_source_files: bool = false, any_non_stripped: bool = false, @@ -359,12 +358,6 @@ pub fn resolve(options: Options) ResolveError!Config { break :b false; }; - const any_unwind_tables = b: { - if (options.any_unwind_tables != .none) break :b options.any_unwind_tables; - - break :b target_util.needUnwindTables(target, link_libunwind, options.any_sanitize_thread); - }; - const link_mode = b: { const explicitly_exe_or_dyn_lib = switch (options.output_mode) { .Obj => false, @@ -496,7 +489,7 @@ pub fn resolve(options: Options) ResolveError!Config { .link_libc = link_libc, .link_libcpp = link_libcpp, .link_libunwind = link_libunwind, - .any_unwind_tables = any_unwind_tables, + .any_unwind_tables = options.any_unwind_tables, .any_c_source_files = options.any_c_source_files, .any_non_single_threaded = options.any_non_single_threaded, .any_error_tracing = any_error_tracing, |
