--- build/config/sanitizers/sanitizers.gni.orig 2026-09-30 02:11:56 UTC +++ build/config/sanitizers/sanitizers.gni @@ -543,14 +543,13 @@ template("ubsan_hardening") { cflags = [ "-fsanitize=${invoker.sanitizer}", "-fsanitize-trap=${invoker.sanitizer}", - - # Prevents `__has_feature(undefined_behavior_sanitizer)` - # from evaluating true. Configs defined here are intended to - # be usable even in release builds, i.e. as widely as possible. - # It's important not to have full-on UBSan workarounds activate - # just because we built support for a specific sanitizer. - "-fsanitize-ignore-for-ubsan-feature=${invoker.sanitizer}", ] + if (!is_bsd) { + # -fsanitize-ignore-for-ubsan-feature is a Chromium clang extension. + cflags += [ + "-fsanitize-ignore-for-ubsan-feature=${invoker.sanitizer}", + ] + } if (defined(invoker.cflags)) { cflags += invoker.cflags }