Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/lang/bun/files/patch-scripts_build_deps_zlib.ts
49052 views
1
-- Skip AVX2/AVX-512 zlib-ng kernels when building for baseline (v1/SSE2).
2
-- zlib-ng unconditionally compiles X86_AVX2, X86_AVX512, X86_AVX512VNNI and
3
-- X86_VPCLMULQDQ_CRC kernels with explicit -mavx512* flags for all x86-64
4
-- builds. In baseline mode the binary must contain only SSE2-level code so that
5
-- it runs on any x86-64 CPU. These kernels are runtime-dispatched correctly but
6
-- the static AVX-512 instructions still appear in the ELF binary and fail the
7
-- cpu-microarchitecture classifier test.
8
9
--- scripts/build/deps/zlib.ts.orig 2026-05-23 01:30:45 UTC
10
+++ scripts/build/deps/zlib.ts
11
@@ -208,6 +208,10 @@ export const zlib: Dependency = {
12
}
13
14
for (const k of kernels) {
15
+ // Skip AVX2/AVX-512 kernels for baseline (v1/SSE2) builds.
16
+ if (cfg.x64 && cfg.baseline && (k.define === "X86_AVX2" ||
17
+ k.define === "X86_AVX512" || k.define === "X86_AVX512VNNI" ||
18
+ k.define === "X86_VPCLMULQDQ_CRC")) continue;
19
defines[k.define] = true;
20
for (const s of k.sources) {
21
sources.push({ path: `arch/${archDir}/${s}.c`, cflags: [...k.flags, "-fno-lto"] });
22
23