commit 41185d297ffcaf61776aa8e7610aea9d00fce3a4 (tree)
parent ef4d7f01a5c26d8ed6fa8236d1b64e4091a51be3
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Thu, 23 Jan 2025 01:43:57 +0100
Package.Module: Make create() fall back on options.global.root_optimize_mode.
As is done for root_strip and root_error_tracing.
Diffstat:
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig
@@ -56,6 +56,7 @@ export_memory: bool,
shared_memory: bool,
is_test: bool,
debug_format: DebugFormat,
+root_optimize_mode: std.builtin.OptimizeMode,
root_strip: bool,
root_error_tracing: bool,
dll_export_fns: bool,
@@ -508,6 +509,7 @@ pub fn resolve(options: Options) ResolveError!Config {
.use_lld = use_lld,
.wasi_exec_model = wasi_exec_model,
.debug_format = debug_format,
+ .root_optimize_mode = root_optimize_mode,
.root_strip = root_strip,
.dll_export_fns = dll_export_fns,
.rdynamic = rdynamic,
diff --git a/src/Package/Module.zig b/src/Package/Module.zig
@@ -119,7 +119,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
const target = resolved_target.result;
const optimize_mode = options.inherited.optimize_mode orelse
- if (options.parent) |p| p.optimize_mode else .Debug;
+ if (options.parent) |p| p.optimize_mode else options.global.root_optimize_mode;
const strip = b: {
if (options.inherited.strip) |x| break :b x;