Skip to content

Commit

Permalink
runtime: initialise cpu.HWCap on openbsd/arm64
Browse files Browse the repository at this point in the history
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 <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
4a6f656c authored and bradfitz committed Apr 29, 2019
1 parent 9308637 commit 08b956f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime/auxv_none.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// +build !dragonfly
// +build !freebsd
// +build !netbsd
// +build !openbsd !arm64
// +build !solaris

package runtime
Expand Down
11 changes: 11 additions & 0 deletions src/runtime/os_openbsd_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@

package runtime

import (
"internal/cpu"
)

//go:nosplit
func cputicks() int64 {
// Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
// runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
// TODO: need more entropy to better seed fastrand.
return nanotime()
}

func sysargs(argc int32, argv **byte) {
// OpenBSD does not have auxv, however we still need to initialise cpu.HWCaps.
// For now specify the bare minimum until we add some form of capabilities
// detection. See issue #31746.
cpu.HWCap = 1<<1 | 1<<0 // ASIMD, FP
}

0 comments on commit 08b956f

Please sign in to comment.