authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-23 20:25:39-08:00
committergravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2025-02-25 11:22:33-08:00
loge18c7f9cca42731792cb9700744380197812747e
tree872473dad8fd87f36be7e4621c011fa9b0b34c55
parentd4413e3504cf7b260a2fd29546ab29d6fd3de079

ubsan: don't create ubsan in every static lib by default

Problem here is if zig is asked to create multiple static libraries, it will build the runtime multiple times and then they will conflict. Instead we want to build the runtime exactly once.

1 files changed, 1 insertions(+), 1 deletions(-)

src/Compilation.zig+1-1
......@@ -1347,7 +1347,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
13471347 // approach, since the ubsan runtime uses quite a lot of the standard library
13481348 // and this reduces unnecessary bloat.
13491349 const ubsan_rt_strat: RtStrat = s: {
1350 const want_ubsan_rt = options.want_ubsan_rt orelse (any_sanitize_c and output_mode != .Obj);
1350 const want_ubsan_rt = options.want_ubsan_rt orelse (any_sanitize_c and is_exe_or_dyn_lib);
13511351 if (!want_ubsan_rt) break :s .none;
13521352 if (options.skip_linker_dependencies) break :s .none;
13531353 if (have_zcu) break :s .zcu;