Path: blob/main/lang/bun/files/patch-scripts_build_deps_zstd.ts
49052 views
-- Disable zstd BMI2 runtime-dispatch when building for baseline (v1/SSE2).1-- zstd compiles a separate BMI2-optimised Huffman encoder function using2-- BMI2_TARGET_ATTRIBUTE (__attribute__((__target__("lzcnt,bmi,bmi2")))).3-- This produces shrxq and other BMI2 instructions which are part of4-- x86-64-v3, causing the cpu-microarchitecture classifier to report a5-- higher-than-v1 required instruction set. Setting DYNAMIC_BMI2=0 prevents6-- this variant from being compiled entirely.78--- scripts/build/deps/zstd.ts.orig 2026-05-23 01:30:45 UTC9+++ scripts/build/deps/zstd.ts10@@ -65,6 +65,11 @@ export const zstd: Dependency = {11defines.ZSTD_DISABLE_ASM = 1;12}1314+ // Disable BMI2 runtime-dispatch for baseline (v1/SSE2) builds.15+ if (cfg.x64 && cfg.baseline) {16+ defines.DYNAMIC_BMI2 = 0;17+ }18+19const spec: DirectBuild = {20kind: "direct",21sources,222324