Skip to content

Commit 08b956f

Browse files
4a6f656cbradfitz
authored andcommitted
runtime: initialise cpu.HWCap on openbsd/arm64
OpenBSD does not provide auxv, however we still need to initialise cpu.HWCap. For now initialise it to the bare minimum, until some form of CPU capability detection is implemented or becomes available - see issue #31746. Updates #31656 Change-Id: I68c3c069319fe60dc873f46def2a67c9f3d937d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/174129 TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 9308637 commit 08b956f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/runtime/auxv_none.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// +build !dragonfly
88
// +build !freebsd
99
// +build !netbsd
10+
// +build !openbsd !arm64
1011
// +build !solaris
1112

1213
package runtime

src/runtime/os_openbsd_arm64.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,21 @@
44

55
package runtime
66

7+
import (
8+
"internal/cpu"
9+
)
10+
711
//go:nosplit
812
func cputicks() int64 {
913
// Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
1014
// runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
1115
// TODO: need more entropy to better seed fastrand.
1216
return nanotime()
1317
}
18+
19+
func sysargs(argc int32, argv **byte) {
20+
// OpenBSD does not have auxv, however we still need to initialise cpu.HWCaps.
21+
// For now specify the bare minimum until we add some form of capabilities
22+
// detection. See issue #31746.
23+
cpu.HWCap = 1<<1 | 1<<0 // ASIMD, FP
24+
}

0 commit comments

Comments
 (0)