Path: blob/main/lang/bun/files/patch-scripts_build_flags.ts
49052 views
-- Support explicit CPU target in C++ compiler flags.1-- If 'cpu' is defined in the configuration, use -march=${cpu} to target2-- the specified microarchitecture, overriding the default baseline/haswell logic.3--4-- Change x64 baseline from nehalem to x86-64-v1 to ensure maximum compatibility5-- on older hardware.6--7-- Add HWY_COMPILE_ONLY_STATIC define for baseline x64 builds. Google Highway's8-- foreach_target.h normally recompiles each translation unit for every supported9-- ISA target via #pragma clang attribute push(__attribute__((target(...)))),10-- ignoring the -march flag. HWY_COMPILE_ONLY_STATIC restricts this to the static11-- target determined by -march (SSE2 with -march=x86-64), preventing AVX/AVX-51212-- code from appearing in the binary when CPUTYPE is unset.1314--- scripts/build/flags.ts.orig 2026-05-12 22:12:49 UTC15+++ scripts/build/flags.ts16@@ -624,6 +624,11 @@ export const defines: Flag[] = [1718// ─── Config-dependent ───19{20+ flag: "HWY_COMPILE_ONLY_STATIC",21+ when: c => c.x64 && c.cpu === undefined && c.baseline,22+ desc: "x64 baseline: compile Highway for SSE2 only (matches -march=x86-64)",23+ },24+ {25flag: "ASSERT_ENABLED=1",26when: c => c.assertions,27desc: "Enable runtime assertions",282930