-
Notifications
You must be signed in to change notification settings - Fork 18k
gccgo: fix NetBSD support #38538
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
Change https://golang.org/cl/228918 mentions this issue: |
This fixes the build of the "runtime" package, now the compilation is stuck in the "syscall" package instead. Submitted upstream as https://go-review.googlesource.com/c/gofrontend/+/228918/. Upstream bug report at golang/go#38538.
si_code in siginfo_t is a macro on NetBSD, not a member of the struct itself, so add a C trampoline for receiving its value. Also replace references to mos.waitsemacount with the replacement and add some helpers from os_netbsd.go in the GC repository. Update golang/go#38538. Change-Id: I818069de3eea8f3d33479542a798c729c9efd042 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/228918 Reviewed-by: Ian Lance Taylor <[email protected]>
si_code in siginfo_t is a macro on NetBSD, not a member of the struct itself, so add a C trampoline for receiving its value. Also replace references to mos.waitsemacount with the replacement and add some helpers from os_netbsd.go in the GC repository. Update golang/go#38538. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/228918
Sorry for the slow reply. The missing definitions are supposed to come from the mksysinfo.sh script. Make sure that sysinfo.c #include's any required header files, and that mksysinfo.sh exposes any constants or types that the Go code requires. |
I'm going to look into this, as it seems like a useful step towards Darwin support. |
Change https://golang.org/cl/261137 mentions this issue: |
Change https://golang.org/cl/261739 mentions this issue: |
The syscall package depends on many NetBSD-specific types on NetBSD. Teach mksysinfo.sh to export these types. This alone is not sufficient to get the syscall package to compile on NetBSD, but it's a start. Note that the IfMsgHdr type is recapitalized to IfMsghdr, which requires changes in the AIX port. The new capitalization is what's used by upstream in existing NetBSD-specific code and is more consistent with the capitalization of other C structs with the "hdr" suffix. Updates golang/go#38538. Change-Id: I56d8d8d887b293d5a9195114cc7f7b44a5b738cb Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261739 Reviewed-by: Benny Siegert <[email protected]> Trust: Benny Siegert <[email protected]> Trust: Than McIntosh <[email protected]>
The syscall package depends on many NetBSD-specific types on NetBSD. Teach mksysinfo.sh to export these types. This alone is not sufficient to get the syscall package to compile on NetBSD, but it's a start. Note that the IfMsgHdr type is recapitalized to IfMsghdr, which requires changes in the AIX port. The new capitalization is what's used by upstream in existing NetBSD-specific code and is more consistent with the capitalization of other C structs with the "hdr" suffix. Updates golang/go#38538. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261739
@benesch Thanks for looking into this! I tried building gccgo from gcc
|
Yep, that’s expected! I have one last batch of changes from the original CL
to clean up and submit. Will try to get to it shortly.
…On Fri, Oct 16, 2020 at 3:24 AM Benny Siegert ***@***.***> wrote:
@benesch <https://github.com/benesch> Thanks for looking into this! I
tried building gccgo from gcc HEAD just now on NetBSD-9, and I still see
errors in the syscall package:
libtool: compile: /home/bsiegert/src/gcc-bis/host-x86_64-unknown-netbsd9.0/gcc/gccgo -B/home/bsiegert/src/gcc-bis/host-x86_64-unknown-netbsd9.0/gcc/ -B/usr/local/x86_64-unknown-netbsd9.0/bin/ -B/usr/local/x86_64-unknown-netbsd9.0/lib/ -isystem /usr/local/x86_64-unknown-netbsd9.0/include -isystem /usr/local/x86_64-unknown-netbsd9.0/sys-include -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=syscall ../.././libgo/go/syscall/bpf_bsd.go ../.././libgo/go/syscall/dirent.go ../.././libgo/go/syscall/endian_little.go ../.././libgo/go/syscall/env_unix.go ../.././libgo/go/syscall/errstr.go ../.././libgo/go/syscall/exec_bsd.go ../.././libgo/go/syscall/exec_unix.go ../.././libgo/go/syscall/forkpipe2.go ../.././libgo/go/syscall/libcall_bsd.go ../.././libgo/go/syscall/libcall_bsd_regfile.go ../.././libgo/go/syscall/libcall_posix.go ../.././libgo/go/syscall/libcall_posix_nonhurd.go ../.././libgo/go/syscall/libcall_posix_regfile.go ../.././libgo/go/syscall/libcall_posix_utimesnano.go ../.././libgo/go/syscall/libcall_support.go ../.././libgo/go/syscall/libcall_uname.go ../.././libgo/go/syscall/libcall_wait4.go ../.././libgo/go/syscall/msan0.go ../.././libgo/go/syscall/net.go ../.././libgo/go/syscall/route_bsd.go ../.././libgo/go/syscall/route_netbsd.go ../.././libgo/go/syscall/sleep_select.go ../.././libgo/go/syscall/sockcmsg_unix.go ../.././libgo/go/syscall/sockcmsg_unix_other.go ../.././libgo/go/syscall/socket.go ../.././libgo/go/syscall/socket_bsd.go ../.././libgo/go/syscall/socket_posix.go ../.././libgo/go/syscall/str.go ../.././libgo/go/syscall/syscall.go ../.././libgo/go/syscall/syscall_errno.go ../.././libgo/go/syscall/syscall_funcs.go ../.././libgo/go/syscall/syscall_netbsd.go ../.././libgo/go/syscall/syscall_unix.go ../.././libgo/go/syscall/time_nofake.go ../.././libgo/go/syscall/timestruct.go libcalls.go sysinfo.go syscall_arch.go -fPIC -o .libs/syscall.o
../.././libgo/go/syscall/route_bsd.go:46:36: error: use of undefined type ‘SockaddrDatalink’
46 | func parseSockaddrLink(b []byte) (*SockaddrDatalink, error) {
| ^
../.././libgo/go/syscall/exec_bsd.go:96:24: error: reference to undefined name ‘raw_ptrace’
96 | err1 = raw_ptrace(_PTRACE_TRACEME, 0, nil, nil)
| ^
../.././libgo/go/syscall/forkpipe2.go:10:16: error: reference to undefined name ‘Pipe2’
10 | return Pipe2(p, O_CLOEXEC)
| ^
../.././libgo/go/syscall/route_bsd.go:40:24: error: incompatible type for return value 1 (cannot use type uintptr as type int)
40 | return salign
| ^
../.././libgo/go/syscall/route_bsd.go:54:18: error: reference to undefined name ‘RawSockaddrDatalink’
54 | rsa := (*RawSockaddrDatalink)(unsafe.Pointer(&b[0]))
| ^
../.././libgo/go/syscall/route_bsd.go:54:17: error: expected pointer
54 | rsa := (*RawSockaddrDatalink)(unsafe.Pointer(&b[0]))
| ^
../.././libgo/go/syscall/route_bsd.go:46:36: error: use of undefined type ‘SockaddrDatalink’
46 | func parseSockaddrLink(b []byte) (*SockaddrDatalink, error) {
| ^
../.././libgo/go/syscall/route_bsd.go:55:11: error: reference to field ‘Len’ in object which has no fields or methods
55 | sa.Len = rsa.Len
| ^
../.././libgo/go/syscall/route_bsd.go:56:11: error: reference to field ‘Family’ in object which has no fields or methods
56 | sa.Family = rsa.Family
| ^
../.././libgo/go/syscall/route_bsd.go:57:11: error: reference to field ‘Index’ in object which has no fields or methods
57 | sa.Index = rsa.Index
| ^
../.././libgo/go/syscall/route_bsd.go:88:33: error: reference to undefined name ‘Type’
88 | sa := &SockaddrDatalink{Type: lla.Type, Nlen: lla.Nlen, Alen: lla.Alen, Slen: lla.Slen}
| ^
../.././libgo/go/syscall/route_bsd.go:88:49: error: reference to undefined name ‘Nlen’
88 | sa := &SockaddrDatalink{Type: lla.Type, Nlen: lla.Nlen, Alen: lla.Alen, Slen: lla.Slen}
| ^
../.././libgo/go/syscall/route_bsd.go:88:65: error: reference to undefined name ‘Alen’
88 | sa := &SockaddrDatalink{Type: lla.Type, Nlen: lla.Nlen, Alen: lla.Alen, Slen: lla.Slen}
| ^
../.././libgo/go/syscall/route_bsd.go:88:81: error: reference to undefined name ‘Slen’
88 | sa := &SockaddrDatalink{Type: lla.Type, Nlen: lla.Nlen, Alen: lla.Alen, Slen: lla.Slen}
| ^
../.././libgo/go/syscall/route_bsd.go:185:19: error: reference to undefined name ‘sysctl’
185 | if err := sysctl(mib, nil, &n, nil, 0); err != nil {
| ^
../.././libgo/go/syscall/route_bsd.go:192:19: error: reference to undefined name ‘sysctl’
192 | if err := sysctl(mib, &tab[0], &n, nil, 0); err != nil {
| ^
../.././libgo/go/syscall/route_netbsd.go:11:102: error: reference to undefined name ‘RTM_RESOLVE’
11 | case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
| ^
../.././libgo/go/syscall/route_bsd.go:46:36: error: use of undefined type ‘SockaddrDatalink’
46 | func parseSockaddrLink(b []byte) (*SockaddrDatalink, error) {
| ^
../.././libgo/go/syscall/route_bsd.go:42:23: error: incompatible types in binary expression
42 | return (salen + salign - 1) & ^(salign - 1)
| ^
../.././libgo/go/syscall/route_bsd.go:237:32: error: incompatible types in assignment (type has no methods)
237 | sas[i] = sa
| ^
../.././libgo/go/syscall/route_bsd.go:277:23: error: incompatible types in assignment (type has no methods)
277 | sas[RTAX_IFP] = sa
| ^
../.././libgo/go/syscall/route_bsd.go:305:32: error: incompatible types in assignment (type has no methods)
305 | sas[i] = sa
| ^
gmake[4]: *** [Makefile:2910: syscall.lo] Error 1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38538 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGXSIFXLX2YBIL7KPAWLGTSK7YMRANCNFSM4MMN62JQ>
.
|
Import some missing upstream code for BSD sockets and sysctls and adapt it for gccgo. Updates golang/go#38538. Change-Id: I3b08bf01b499b5be55ef79b4633f47ba266d0148 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261137 Reviewed-by: Ian Lance Taylor <[email protected]> Trust: Benny Siegert <[email protected]>
Import some missing upstream code for BSD sockets and sysctls and adapt it for gccgo. Updates golang/go#38538. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/261137
Change https://golang.org/cl/265123 mentions this issue: |
Import additional code from upstream for handing system calls on BSD systems. This makes the syscall package on NetBSD complete enough to compile the standard library. Updates golang/go#38538. Change-Id: I15644dbbd78b1acebcaf45b49403f07c929d97ed Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/265123 Reviewed-by: Ian Lance Taylor <[email protected]> Trust: Benny Siegert <[email protected]>
With a recent NetBSD-current and the latest tip of GCC, compilation on NetBSD succeeds! 🎉 The test suite mostly passes, too, with a few notable exceptions:
The math failures are, I suspect, actual bugs in NetBSD's libc. See, for example, http://gnats.netbsd.org/45391. The time failures are weirder. Everything seems to be off by an hour. I haven't had time to really look into why. @bsiegert, if you're up for poking at this, would be much appreciated! I've done most of the work I plan to do on this. |
Ah, indeed! NetBSD/src@c783255 Thanks. That saved me a lot of head scratching. |
The timestamp failures have been resolved on NetBSD with the latest sources. The only remaining failures, as mentioned above, are:
These appear to be bugs in NetBSD's libc, and at least the |
Thanks! |
What version of Go are you using (
go version
)?gcc-9.3.0 with
--enable-languages=c,c++,go
Does this issue reproduce with the latest release?
gcc HEAD from git has the same issue.
What operating system and processor architecture are you using (
go env
)?NetBSD 9.0 / amd64
What did you do?
I tried to compile gccgo using the GCC 9.3.0 release. NetBSD is nominally supported by gccgo. I did this using the OS packaging setup:
What did you expect to see?
I expected a working gccgo compiler.
What did you see instead?
Compilation fails when compiling the
runtime
package. I have a candidate CL (against gcc HEAD) to fix this, but now there are a lot of errors when compiling thesyscall
package:As far as I can tell, there are no
z*
files per os in thesyscall
package. I would appreciate a hint about where these missing definitions are supposed to come from./cc @ianlancetaylor @tklauser
The text was updated successfully, but these errors were encountered: