build: disable bundled ubsan runtime on Windows

Zig's ubsan runtime emits /exclude-symbols linker directives that
are incompatible with the MSVC linker, causing LNK4229 warnings and
LNK1143 errors. Disable bundling ubsan_rt on Windows while keeping
compiler_rt which provides essential symbols like memcpy, memset,
memmove, and ___chkstk_ms.

The previous check used target.result.abi == .msvc which never
matched because Zig defaults to the gnu ABI on Windows.
This commit is contained in:
Mitchell Hashimoto
2026-03-23 11:12:19 -07:00
parent 1ce057f053
commit 69f82ec751

View File

@@ -107,12 +107,8 @@ fn initLib(
}
if (target.result.os.tag == .windows) {
// Zig's ubsan emits /exclude-symbols linker directives and
// its compiler_rt produces COMDAT sections that are
// incompatible with the MSVC linker (LNK1143, LNK4229).
// Skip bundling these runtimes on Windows since consumers
// link against the MSVC runtime.
lib.bundle_compiler_rt = false;
// Zig's ubsan emits /exclude-symbols linker directives that
// are incompatible with the MSVC linker (LNK4229).
lib.bundle_ubsan_rt = false;
}