Commit 41185d297f

Alex Rønne Petersen <alex@alexrp.com>
2025-01-23 01:43:57
Package.Module: Make create() fall back on options.global.root_optimize_mode.
As is done for root_strip and root_error_tracing.
1 parent ef4d7f0
Changed files (2)
src
Compilation
Package
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,
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;