Path: blob/main/lang/bun/files/patch-scripts_build_deps_zlib.ts
49052 views
-- Skip AVX2/AVX-512 zlib-ng kernels when building for baseline (v1/SSE2).1-- zlib-ng unconditionally compiles X86_AVX2, X86_AVX512, X86_AVX512VNNI and2-- X86_VPCLMULQDQ_CRC kernels with explicit -mavx512* flags for all x86-643-- builds. In baseline mode the binary must contain only SSE2-level code so that4-- it runs on any x86-64 CPU. These kernels are runtime-dispatched correctly but5-- the static AVX-512 instructions still appear in the ELF binary and fail the6-- cpu-microarchitecture classifier test.78--- scripts/build/deps/zlib.ts.orig 2026-05-23 01:30:45 UTC9+++ scripts/build/deps/zlib.ts10@@ -208,6 +208,10 @@ export const zlib: Dependency = {11}1213for (const k of kernels) {14+ // Skip AVX2/AVX-512 kernels for baseline (v1/SSE2) builds.15+ if (cfg.x64 && cfg.baseline && (k.define === "X86_AVX2" ||16+ k.define === "X86_AVX512" || k.define === "X86_AVX512VNNI" ||17+ k.define === "X86_VPCLMULQDQ_CRC")) continue;18defines[k.define] = true;19for (const s of k.sources) {20sources.push({ path: `arch/${archDir}/${s}.c`, cflags: [...k.flags, "-fno-lto"] });212223