From 83a3e5aba719bd8bb8c3141bad2e1cfb4a1dd9df Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Thu, 23 Apr 2026 09:54:44 +0900 Subject: [PATCH] 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. --- src/build/SharedDeps.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/build/SharedDeps.zig b/src/build/SharedDeps.zig index f0457d6b5..5ca5368d7 100644 --- a/src/build/SharedDeps.zig +++ b/src/build/SharedDeps.zig @@ -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", });