[Bug 256897] lang/go: unable to build on armv7

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 30 Jun 2021 02:22:57 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256897

            Bug ID: 256897
           Summary: lang/go: unable to build on armv7
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: dmgk_at_freebsd.org
          Reporter: brd_at_FreeBSD.org
                CC: jhb_at_FreeBSD.org, paulzhol_at_gmail.com
             Flags: maintainer-feedback?(dmgk_at_freebsd.org)
          Assignee: dmgk_at_freebsd.org

I have been trying to figure out why go won't build in an armv7 jail on a arm64
builder (AWS Graviton2 instance w/ HW FP).

This is the error:

runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=7 binary. Recompile using GOARM=5.

So I added some debugging:

diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go
index 730973a202..2ff154ce32 100644
--- a/src/runtime/os_freebsd.go
+++ b/src/runtime/os_freebsd.go
_at__at_ -405,6 +405,7 _at__at_ func sysauxv(auxv []uintptr) {
                        timekeepSharedPage =
(*vdsoTimekeep)(unsafe.Pointer(val))
                }

+               print("calling archauxv with tag = ", tag, ", val = ", val,
"\n")
                archauxv(tag, val)
        }
}
diff --git a/src/runtime/os_freebsd_arm.go b/src/runtime/os_freebsd_arm.go
index 3feaa5e225..a894e7de5e 100644
--- a/src/runtime/os_freebsd_arm.go
+++ b/src/runtime/os_freebsd_arm.go
_at__at_ -15,6 +15,7 _at__at_ func checkgoarm() {
        if goarm > 5 && cpu.HWCap&_HWCAP_VFP == 0 {
                print("runtime: this CPU has no floating point hardware, so it
cannot run\n")
                print("this GOARM=", goarm, " binary. Recompile using
GOARM=5.\n")
+               print("cpu.HWCap=", cpu.HWCap, "; vfp=", _HWCAP_VFP, ".\n")
                exit(1)
        }
        if goarm > 6 && cpu.HWCap&_HWCAP_VFPv3 == 0 {

and built a new bootstrap using github.com/dmgk/go-bootstrap repo.  Which
showed me that cpu.HWCap is 0:

Building Go cmd/dist using
/wrkdirs/usr/ports/lang/go/work/go-freebsd-arm7-bootstrap. ()
cmd/dist
calling archauxv with tag = 3, val = 65588
calling archauxv with tag = 4, val = 32
calling archauxv with tag = 5, val = 5
calling archauxv with tag = 6, val = 4096
calling archauxv with tag = 8, val = 0
calling archauxv with tag = 9, val = 471532
calling archauxv with tag = 7, val = 0
calling archauxv with tag = 24, val = 83886082
calling archauxv with tag = 15, val = 4294959023
calling archauxv with tag = 18, val = 1300139
calling archauxv with tag = 16, val = 4294958959
calling archauxv with tag = 17, val = 64
calling archauxv with tag = 19, val = 4
calling archauxv with tag = 20, val = 4294958944
calling archauxv with tag = 21, val = 12
calling archauxv with tag = 22, val = 4294959152
calling archauxv with tag = 23, val = 3
calling archauxv with tag = 27, val = 1
calling archauxv with tag = 28, val = 5
calling archauxv with tag = 29, val = 4294956876
calling archauxv with tag = 30, val = 55
calling archauxv with tag = 31, val = 4294956900
calling archauxv with tag = 32, val = 4294959088
runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=7 binary. Recompile using GOARM=5.
cpu.HWCap=0; vfp=64.

So far I have tracked down these parts:

We never set cpu.HWCap here:
https://github.com/golang/go/blob/master/src/runtime/os_freebsd_arm.go#L34-L40

Because on FreeBSD we have_AT_HWCAP = 25
https://github.com/golang/go/blob/master/src/runtime/os_freebsd.go#L402-L419

I am not sure where to go from here.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Wed Jun 30 2021 - 02:22:57 UTC

Original text of this message