From 63260ec7221741fb0c0a0e2f1018da094b116af9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 23 Mar 2026 12:31:17 -0700 Subject: [PATCH] build: disable ubsan for SIMD C++ files on MSVC The SIMD C++ files reference __ubsan_handle_* symbols when compiled in debug mode, but we do not link or bundle the ubsan runtime on MSVC. This matches what the highway and simdutf packages already do in their own build files. --- src/build/SharedDeps.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/build/SharedDeps.zig b/src/build/SharedDeps.zig index 573c68b74..e01adb1fa 100644 --- a/src/build/SharedDeps.zig +++ b/src/build/SharedDeps.zig @@ -812,6 +812,14 @@ pub fn addSimd( "-std=c++17", ); + // 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, &.{ + "-fno-sanitize=undefined", + "-fno-sanitize-trap=undefined", + }); + m.addCSourceFiles(.{ .files = &.{ "src/simd/base64.cpp",