windows: disable C++ ubsan regardless of ABI

The existing `-fno-sanitize=undefined` flag was gated on `abi == .msvc`
to avoid undefined `__ubsan_handle_*` references from simdutf/highway.
The same linker error reproduces on Windows GNU ABI for the same
reason: the Zig-bundled libraries don't provide a matching UBSan
runtime for these C/C++ objects in our build configurations.

Widen the condition to `os.tag == .windows` so both MSVC and GNU
Windows targets skip ubsan for these C++ deps.
This commit is contained in:
Yasuhiro Matsumoto
2026-04-23 09:54:44 +09:00
parent 880a599d66
commit 83a3e5aba7

View File

@@ -836,10 +836,11 @@ pub fn addSimd(
"-DSIMDUTF_NO_LIBCXX",
);
// Disable ubsan for MSVC to avoid undefined references to
// __ubsan_handle_* symbols that require a runtime we don't link
// and bundle. Hopefully we can fix this one day since ubsan is nice!
if (target.result.abi == .msvc) try flags.appendSlice(b.allocator, &.{
// Disable ubsan for Windows C/C++ objects to avoid undefined
// __ubsan_handle_* references. The Zig libraries on Windows don't
// currently bundle a matching UBSan runtime for these objects in
// our build configurations (this affects both MSVC and GNU ABIs).
if (target.result.os.tag == .windows) try flags.appendSlice(b.allocator, &.{
"-fno-sanitize=undefined",
"-fno-sanitize-trap=undefined",
});