Skip to content

Commit 04e42a7

Browse files
committed
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 parent 5bd53f7 commit 04e42a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Compilation.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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;

0 commit comments

Comments
 (0)