https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86535
--- Comment #25 from Ian Lance Taylor <ian at airs dot com> --- The code in os_freebsd.go is written for the gc toolchain. You'll need to look at it and see whether it makes sense for gccgo. That said, that call to sysctl does seem to make sense. You'll need to add something like this to os_freebsd.go: //go:noescape //extern sysctl func sysctl(*uint32, uint32, *byte, *uintptr, unsafe.Pointer, uintptr) int32