-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: arm FreeBSD should work around missing ELF auxiliary vectors #47006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
questions:
We may look into a workaround (if easy) for go1.17/go1.18 but im not sure since this is a bug in FreeBSD and it seems has a workaround (compile with GOARM=5) this qualifies for a backport. I would assume the number of active uses of running go |
Looking at the PR it seems the HWCap auxilary vectors are not provided at all (not just 0). Therefore the easiest workaround seems to record a bool in Go runtime for FreeBSD and if its not true skip the runtime checks for goarm. Likely with a hint that the expected aux values were not supplied. |
Hi @martinsch, let me try to address your questions:
The main purpose of running armv7 Go on arm64 is to build the FreeBSD ports tree (I believe this is why this support was added in the first place). Ever since the advent of fast arm64 machines, this has been desirable over building armv7 ports on QEMU and AFAIK the armv7 ports builders run by the FreeBSD project do it this way. So this issue means that no port based on Go has armv7 binary packages available at the moment. It also means that Go developers on FreeBSD cannot test their software on armv7 on a machine with arm64 kernel and will have to buy a separate ARM machine for armv7 testing. |
Thanks for the context. I think we can just reintroduce the code removed in: 3b6216e with a new comment explaining FreeBSD 13 Release doesnt set HWCap for arm on arm64 hosts. I will send a CL early next week and let the go release team decide if they allow a backport or if FreeBSD team should patch it in until its resolved in FreeBSD. |
@martisch Any progress with this one? |
Change https://golang.org/cl/335791 mentions this issue: |
@dmitshur @golang/release would it be possible to add the reintroduced workaround for missing AT_HWCAP on FreeBSD arm into go 1.17 release (or if preferred a patch release)? @clausecker please test if https://golang.org/cl/335791 works in an armv7 jail on arm64. |
Any progress on the CL? Meanwhile, FreeBSD has fixed the issue kernel side and the fix is slated to appear in FreeBSD 13.1-RELEASE. However, that release is not going to be released until next year I believe. |
The CL would need to be accepted as a backport. This I can not ratify alone. Without a backport this may land in go1.18 if accepted, but it seems this would by the time be solved by FreeBSD 13.1-RELEASE itself. So it seems the only question is if this warrants a back port or not to work around omissions of setting HWCAP in the FreeBSD 13 Release. /cc @aclements |
Seems this was fixed upstream https://reviews.freebsd.org/D31175 so closing. |
What version of Go are you using (
go version
)?Go 1.16.5 as provided by the FreeBSD ports tree in
lang/go
.Does this issue reproduce with the latest release?
Not tested.
What operating system and processor architecture are you using (
go env
)?arm
withGOARM=7
onarm64
FreeBSD 13.0-RELEASE.What did you do?
Attempt to build and run any armv7 Go program in an armv7 jail on arm64 FreeBSD 13.0-RELEASE.
What did you expect to see?
A working Go program.
What did you see instead?
Additional notes
Due to a bug (PR #256897, PR #256903) in FreeBSD 13.0-RELEASE, the
AT_HWCAP
andAT_HWCAP2
ELF auxiliary vectors are not provided to arm programs running under arm64 FreeBSD 13.0-RELEASE. Unfortunately, the Go runtime uses these vectors to check for floating point support and erroneously believe that no such support is available if the auxiliary vectors are missing.To make running arm Go programs on arm64 FreeBSD 13.0-RELEASE possible, I suggest to change the floating point support detection code in
src/runtime/os_freebsd_arm.go
to be changed such that it checks for the presence ofAT_HWCAP
andAT_HWCAP2
and only denies execution if both vectors are present and indicate lack of support. If the vectors are not present, we are on a system that indicates neither presence nor absence of floating point support via the ELF auxilary vectors and proceed with execution. I believe that only affects arm64 FreeBSD 13.0-RELEASE which should always haveGOARM=7
compatible floating point support as that is architectural for ARMv8-A.The text was updated successfully, but these errors were encountered: