-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
all: support netbsd/arm64 #30824
Comments
Change https://golang.org/cl/155739 mentions this issue: |
What's the plan for a builder? |
We can run a builder on Scaleway, with the caveat that there needs to be a working builder binary first :) Otherwise, I could contribute a builder on real hardware; I have an arm64 machine running NetBSD. |
Oh, does NetBSD boot on Scaleway ARM64 instances? I never had much luck with non-Linux OSes on Scaleway. |
I can see two problems, (1) By code inspection, nothing seems to set TLS. (2) broken signal handling. if I send SIGINFO (^T), it usually segfaults,
here g.m=NULL. I guess g is invalid. The code for that is the runtime.sig* functions. It's probably just wrong and not exercised by other things. |
let's just move this to linux? made #31583 for this |
One nit (sorry):
In all the added files, can you please make the headers say "Copyright
2019"? Thanks!
--
Benny
|
This works well enough to run some code natively on arm64, but not well enough for more complicated code. I've been suggested to start a pull request anyway. Updates #30824 Change-Id: Ib4f63e0e8a9edfc862cf65b5f1b0fbf9a8a1628e GitHub-Last-Rev: b01b105 GitHub-Pull-Request: #29398 Reviewed-on: https://go-review.googlesource.com/c/go/+/155739 Run-TryBot: Benny Siegert <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Benny Siegert <[email protected]>
Change https://golang.org/cl/174078 mentions this issue: |
Updates #30824 Change-Id: I3d9ad7896d528d8274ec78378a546b0356986b9d Reviewed-on: https://go-review.googlesource.com/c/go/+/174078 Reviewed-by: Brad Fitzpatrick <[email protected]>
Change https://golang.org/cl/175237 mentions this issue: |
CL 155739 added the generated files but didn't update mkall.sh. Do so now. Updates #30824 Change-Id: I642bbff6afbc976091a0dc291fa2beff5e245246 Reviewed-on: https://go-review.googlesource.com/c/go/+/175237 Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Benny Siegert <[email protected]> Run-TryBot: Benny Siegert <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
Change https://golang.org/cl/177120 mentions this issue: |
Where/when possible Go will use a dedicated register rather than using TLS - in the case of arm64, this is register R28 (g). If cgo is used then the resulting binary has a PT_TLS segment and the dynamic loader (ld.so) is usually responsible for allocating and setting up TLS, which can then be used by the thread. In the case of cgo the g register is still used, however there are known points where we have to reload it from TLS.
The main reason for this is that the NetBSD kernel trashes the g register, by storing a pointer to the ucontext in R28 (in addition to R2) - see At first glance, in the non-cgo case we may be able to be somewhat "clever" and reload g from the mcontext, since it should match what we had previously. Otherwise it would need to use a similar set up to what amd64 does - use |
Fix various bugs in the netbsd/arm64 runtime assembly. Updates #30824. Change-Id: I5ca10926ab663a8ff4df9973530e645e2469c1aa Reviewed-on: https://go-review.googlesource.com/c/go/+/177120 Reviewed-by: Benny Siegert <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Run-TryBot: Benny Siegert <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
While reading through some code I noticed https://golang.org/cl/174129 and its related issue #31746 regarding CPU feature detection on |
netbsd doesn't supply AT_HWCAP either, but it does have a bunch of sysctls. I wonder how bad it will be to just provide AT_HWCAP. |
Change https://golang.org/cl/179939 mentions this issue: |
Updates golang/go#30824 Change-Id: I872b725d6640e29570652171b6c45634fc21a461 Reviewed-on: https://go-review.googlesource.com/c/net/+/179939 Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Benny Siegert <[email protected]>
So I tried a test run on a real machine, a Raspberry Pi 3 running NetBSD-current in 64-bit mode.
Other invocations of the go tool that I tried fail in the same way. Here are full outputs of backtraces from gdb and The relevant bits are, I think:
And:
Note that line 248 is in the implementation of |
@bsiegert - signal handling is currently completely broken, since the kernel trashes the |
Change https://golang.org/cl/192998 mentions this issue: |
…port on NetBSD and OpenBSD Those configurations currently lack builders, and it is not clear to me what state their tests are in. The Go porting policy¹ requires builders for all active ports, so let's not claim support until that requirement is met. ¹https://golang.org/wiki/PortingPolicy#requirements-for-a-new-port Updates #30824 Updates #31656 Updates #34035 Updates #34036 Change-Id: I6496de9d92fb8546048abf139cf10546a47e314b Reviewed-on: https://go-review.googlesource.com/c/go/+/192997 Reviewed-by: Dmitri Shuralyov <[email protected]> (cherry picked from commit 9f5127b) Reviewed-on: https://go-review.googlesource.com/c/go/+/192998 Run-TryBot: Bryan C. Mills <[email protected]>
Those configurations currently lack builders, and it is not clear to me what state their tests are in. The Go porting policy¹ requires builders for all active ports, so let's not claim support until that requirement is met. ¹https://golang.org/wiki/PortingPolicy#requirements-for-a-new-port Updates golang#30824 Updates golang#31656 Updates golang#34035 Updates golang#34036 Change-Id: I6496de9d92fb8546048abf139cf10546a47e314b Reviewed-on: https://go-review.googlesource.com/c/go/+/192997 Reviewed-by: Dmitri Shuralyov <[email protected]>
There are some local patches in the pkgsrc repository that make Go actually work on netbsd/arm64. Would these patches be accepted during the freeze? It would be awesome if we could get arm64 support as part of Go 1.15. |
Change https://golang.org/cl/235097 mentions this issue: |
On NetBSD, this package tries to read a privileged register, which results in a SIGILL. Use the same workaround as Android and iOS. In the future, we could use sysctl(3) instead. Update golang/go#30824 Change-Id: Ifd9aa2a2cf4dac43341d013602d1ccb4b8d6eb6d Reviewed-on: https://go-review.googlesource.com/c/sys/+/235097 Reviewed-by: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
Change https://golang.org/cl/231957 mentions this issue: |
I’d rather we not land anything in the tree this far into the freeze. Sorry. |
Since NetBSD 7, hw.ncpuonline reports the number of CPUs online, while hw.cpu reports the number of CPUs configured. Try hw.cpuonline first and fall back to hw.ncpu in case it fails (which is the case on NetBSD before 7.0). This follows the behavior on OpenBSD (see CL 161757). Also, Go in pkgsrc is patched to use hw.cpuonline, so this CL would allow said patch to be dropped. Updates #30824 Change-Id: Id1c19dff2c1e4401e6074179fae7c708ba0e3098 Reviewed-on: https://go-review.googlesource.com/c/go/+/231957 Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Benny Siegert <[email protected]>
Change https://golang.org/cl/257643 mentions this issue: |
On netbsd/arm64 `uname -m` reports `evbarm` which is mapped to gohostarch=arm. Fix this by checking for "aarch64" in `uname -p` output to fix self-hosted build on netbsd/arm64. Updates #30824 Change-Id: I0f0450ff35af0bec51aeec3b210143ba892216c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/257643 Trust: Tobias Klauser <[email protected]> Trust: Benny Siegert <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Benny Siegert <[email protected]>
Change https://golang.org/cl/257645 mentions this issue: |
Add missing declaration of crosscall1. Fix stack alignment for pipe2 return value. Work around kernel clobbering of r28 on aarch64 by reloading from ucontext. https://nxr.netbsd.org/xref/src/sys/arch/aarch64/aarch64/sig_machdep.c#104 Update #30824 Change-Id: I7f9472939f4c02953f8c207308610118f5d3c54c Reviewed-on: https://go-review.googlesource.com/c/go/+/257645 Reviewed-by: Ian Lance Taylor <[email protected]> Trust: Benny Siegert <[email protected]>
Change https://golang.org/cl/257938 mentions this issue: |
Change https://golang.org/cl/257998 mentions this issue: |
NetBSD does not supply AT_HWCAP, however we still need to initialise cpu.HWCaps. For now specify the bare minimum until we add some form of capabilities detection. See https://golang.org/issue/30824#issuecomment-494901591 Follows CL 174129 which did the same for openbsd/arm64. Updates #30824 Change-Id: I43a86b583bc60d259a66772703de06970124bb7f Reviewed-on: https://go-review.googlesource.com/c/go/+/257998 Trust: Tobias Klauser <[email protected]> Trust: Benny Siegert <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Benny Siegert <[email protected]> TryBot-Result: Go Bot <[email protected]>
The build fails on 1.15 and earlier. Updates golang/go#30824 Change-Id: I1f62d37cc05dde988cbb7e5124bd97916b38bcb3 Reviewed-on: https://go-review.googlesource.com/c/build/+/257938 Trust: Tobias Klauser <[email protected]> Trust: Benny Siegert <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Benny Siegert <[email protected]>
Change https://golang.org/cl/258000 mentions this issue: |
Follow the implementation of pipe2 to pass arguments and handle return values. With this fix the runtime tests pass on netbsd/arm64 (tested using gomote on the netbsd-arm64-bsiegert builder). Update #30824 Change-Id: I346db68fc9dde8dc7f11351af05c1ad3105f4a32 Reviewed-on: https://go-review.googlesource.com/c/go/+/258000 Trust: Tobias Klauser <[email protected]> Trust: Benny Siegert <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Benny Siegert <[email protected]> TryBot-Result: Go Bot <[email protected]>
So with the last change, we finally seem to have a builder that finishes with an "ok" status. Thanks everyone for this achievement! |
Change https://golang.org/cl/259277 mentions this issue: |
netbsd/arm64 now complies with all the requirements for a port as specified on https://golang.org/wiki/PortingPolicy Note that this was preliminarily announced in the Go 1.13 release notes (CL 183637) but then removed again due to the port lacking a builder at that time (CL 192997). Updates #30824 Change-Id: I2f40fabc84fe9cb699282e6a9d13ed9b64478e36 Reviewed-on: https://go-review.googlesource.com/c/go/+/259277 Trust: Tobias Klauser <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Per #42422, this port still appears to be unstable. |
|
Tracking progress of netbsd/arm64 support:
#29398 adds support, not completely functional.
A simple program (hello world) runs, getting further and trying to build Go itself fails.
The text was updated successfully, but these errors were encountered: