src/internal/cpu/cpu_x86_netbsd.go | 32 ++++++++++++++++++++++++++++++++ src/internal/cpu/cpu_x86_other.go | 2 +- diff --git a/src/internal/cpu/cpu_x86_netbsd.go b/src/internal/cpu/cpu_x86_netbsd.go new file mode 100644 index 0000000000000000000000000000000000000000..eca3540bb21a65cf18bf648f44ffe83696ed399a --- /dev/null +++ b/src/internal/cpu/cpu_x86_netbsd.go @@ -0,0 +1,32 @@ +// Copyright 2026 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (386 || amd64) && netbsd + +package cpu + +func osInit() { + // NetBSD corrupts avx registers when receiving signals. + // See issue 80285. + // TODO: when NetBSD fixes the bug, add a version + // check and skip here. + X86.HasAVX = false + X86.HasAVX2 = false + // Set these also, just to be safe + X86.HasAVXVNNI = false + X86.HasAVX512 = false + X86.HasAVX512F = false + X86.HasAVX512CD = false + X86.HasAVX512BW = false + X86.HasAVX512DQ = false + X86.HasAVX512VL = false + X86.HasAVX512GFNI = false + X86.HasAVX512VAES = false + X86.HasAVX512VNNI = false + X86.HasAVX512VBMI = false + X86.HasAVX512VBMI2 = false + X86.HasAVX512BITALG = false + X86.HasAVX512VPOPCNTDQ = false + X86.HasAVX512VPCLMULQDQ = false +} diff --git a/src/internal/cpu/cpu_x86_other.go b/src/internal/cpu/cpu_x86_other.go index 824131226c643ecc5cf3bebdda7174af63ea6bee..5b46300e2712a9379f17be0668980b27b2dd1ee6 100644 --- a/src/internal/cpu/cpu_x86_other.go +++ b/src/internal/cpu/cpu_x86_other.go @@ -2,7 +2,7 @@ // Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (386 || amd64) && (!darwin || ios) +//go:build (386 || amd64) && (!darwin || ios) && !netbsd package cpu