Skip to content
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

x/net: syscall support for linux/ppc (gccgo) #45677

Closed
bwh-mind opened this issue Apr 21, 2021 · 4 comments
Closed

x/net: syscall support for linux/ppc (gccgo) #45677

bwh-mind opened this issue Apr 21, 2021 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bwh-mind
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.14.6 gccgo (Debian 10.2.1-6) 10.2.1 20210110 linux/amd64

Does this issue reproduce with the latest release?

Not tested, but the master branch of the net repository is still missing support for linux/ppc.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="ppc"
GOBIN=""
GOCACHE="/home/bwh/.cache/go-build"
GOENV="/home/bwh/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/bwh/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-linux-gnu/10"
GCCGO="/usr/bin/x86_64-linux-gnu-gccgo-10"
AR="ar"
CC="x86_64-linux-gnu-gcc-10"
CXX="x86_64-linux-gnu-g++-10"
CGO_ENABLED="0"
GOMOD="/home/bwh/gccgo-docker/golang.org/x/net/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build799208538=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

Used a fork of x/sys from golang/sys#106, which adds support for linux/ppc. Tried to build a trivial test program:

package main

import _ "golang.org/x/net/ipv4"

func main() {
}

What did you expect to see?

This should build successfully.

I have local changes to fix this and will open a PR shortly.

What did you see instead?

go build -v -o test test.go Output
golang.org/x/sys/internal/unsafeheader
golang.org/x/net/internal/iana
golang.org/x/net/bpf
golang.org/x/sys/unix
golang.org/x/net/internal/socket
# golang.org/x/net/internal/socket
../go/src/golang.org/x/net/internal/socket/cmsghdr.go:10:10: error: use of undefined type ‘cmsghdr’
   10 | func (h *cmsghdr) len() int { return int(h.Len) }
      |          ^
../go/src/golang.org/x/net/internal/socket/cmsghdr.go:10:43: error: reference to field ‘Len’ in object which has no fields or methods
   10 | func (h *cmsghdr) len() int { return int(h.Len) }
      |                                           ^
../go/src/golang.org/x/net/internal/socket/cmsghdr.go:11:43: error: reference to field ‘Level’ in object which has no fields or methods
   11 | func (h *cmsghdr) lvl() int { return int(h.Level) }
      |                                           ^
../go/src/golang.org/x/net/internal/socket/cmsghdr.go:12:43: error: reference to field ‘Type’ in object which has no fields or methods
   12 | func (h *cmsghdr) typ() int { return int(h.Type) }
      |                                           ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:19:22: error: reference to undefined name ‘sizeofSockaddrInet6’
   19 |    sa = make([]byte, sizeofSockaddrInet6)
      |                      ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:19:22: error: non-integer len argument in make
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:12:17: error: use of undefined type ‘mmsghdr’
   12 | type mmsghdrs []mmsghdr
      |                 ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:24:8: error: reference to field ‘Hdr’ in object which has no fields or methods
   24 |   hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa)
      |        ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:31:22: error: reference to field ‘Len’ in object which has no fields or methods
   31 |   ms[i].N = int(hs[i].Len)
      |                      ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:32:19: error: reference to field ‘Hdr’ in object which has no fields or methods
   32 |   ms[i].NN = hs[i].Hdr.controllen()
      |                   ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:33:22: error: reference to field ‘Hdr’ in object which has no fields or methods
   33 |   ms[i].Flags = hs[i].Hdr.flags()
      |                      ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:36:35: error: reference to field ‘Hdr’ in object which has no fields or methods
   36 |    ms[i].Addr, err = parseFn(hs[i].Hdr.name(), hint)
      |                                   ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:16:16: error: use of undefined type ‘iovec’
   16 |   vs := make([]iovec, len(ms[i].Buffers))
      |                ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:11:8: error: reference to field ‘set’ in object which has no fields or methods
   11 |   vs[i].set(bs[i])
      |        ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:9:10: error: use of undefined type ‘msghdr’
    9 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) {
      |          ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:13:3: error: reference to field ‘setIov’ in object which has no fields or methods
   13 |  h.setIov(vs)
      |   ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:15:4: error: reference to field ‘setControl’ in object which has no fields or methods
   15 |   h.setControl(oob)
      |    ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:18:4: error: reference to field ‘Name’ in object which has no fields or methods
   18 |   h.Name = (*byte)(unsafe.Pointer(&sa[0]))
      |    ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:19:4: error: reference to field ‘Namelen’ in object which has no fields or methods
   19 |   h.Namelen = uint32(len(sa))
      |    ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:24:6: error: reference to field ‘Name’ in object which has no fields or methods
   24 |  if h.Name != nil && h.Namelen > 0 {
      |      ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:24:23: error: reference to field ‘Namelen’ in object which has no fields or methods
   24 |  if h.Name != nil && h.Namelen > 0 {
      |                       ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:25:55: error: reference to field ‘Name’ in object which has no fields or methods
   25 |   return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen]
      |                                                       ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:25:13: error: reference to undefined name ‘sizeofSockaddrInet6’
   25 |   return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen]
      |             ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:25:65: error: reference to field ‘Namelen’ in object which has no fields or methods
   25 |   return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen]
      |                                                                 ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:31:14: error: reference to field ‘Controllen’ in object which has no fields or methods
   31 |  return int(h.Controllen)
      |              ^
../go/src/golang.org/x/net/internal/socket/msghdr_linux.go:35:14: error: reference to field ‘Flags’ in object which has no fields or methods
   35 |  return int(h.Flags)
      |              ^
../go/src/golang.org/x/net/internal/socket/rawconn_msg.go:21:21: error: reference to undefined name ‘sizeofSockaddrInet6’
   21 |   sa = make([]byte, sizeofSockaddrInet6)
      |                     ^
../go/src/golang.org/x/net/internal/socket/rawconn_msg.go:21:21: error: non-integer len argument in make
../go/src/golang.org/x/net/internal/socket/rawconn_msg.go:23:3: error: reference to field ‘pack’ in object which has no fields or methods
   23 |  h.pack(vs, m.Buffers, m.OOB, sa)
      |   ^
../go/src/golang.org/x/net/internal/socket/rawconn_msg.go:47:10: error: reference to field ‘controllen’ in object which has no fields or methods
   47 |  m.NN = h.controllen()
      |          ^
../go/src/golang.org/x/net/internal/socket/rawconn_msg.go:48:13: error: reference to field ‘flags’ in object which has no fields or methods
   48 |  m.Flags = h.flags()
      |             ^
../go/src/golang.org/x/net/internal/socket/rawconn_msg.go:60:3: error: reference to field ‘pack’ in object which has no fields or methods
   60 |  h.pack(vs, m.Buffers, m.OOB, sa)
      |   ^
../go/src/golang.org/x/net/internal/socket/socket.go:135:3: error: reference to field ‘set’ in object which has no fields or methods
  135 |  h.set(controlMessageLen(dataLen), lvl, typ)
      |   ^
../go/src/golang.org/x/net/internal/socket/socket.go:147:10: error: reference to field ‘lvl’ in object which has no fields or methods
  147 |  return h.lvl(), h.typ(), int(uint64(h.len()) - uint64(l)), nil
      |          ^
../go/src/golang.org/x/net/internal/socket/socket.go:147:19: error: reference to field ‘typ’ in object which has no fields or methods
  147 |  return h.lvl(), h.typ(), int(uint64(h.len()) - uint64(l)), nil
      |                   ^
../go/src/golang.org/x/net/internal/socket/socket.go:147:39: error: reference to field ‘len’ in object which has no fields or methods
  147 |  return h.lvl(), h.typ(), int(uint64(h.len()) - uint64(l)), nil
      |                                       ^
../go/src/golang.org/x/net/internal/socket/socket.go:158:3: error: reference to field ‘set’ in object which has no fields or methods
  158 |  h.set(controlMessageLen(l), lvl, typ)
      |   ^
../go/src/golang.org/x/net/internal/socket/socket.go:172:9: error: reference to field ‘len’ in object which has no fields or methods
  172 |   l := h.len()
      |         ^
../go/src/golang.org/x/net/internal/socket/sys_linux.go:16:34: error: reference to undefined name ‘sysRECVMMSG’
   16 |  n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
      |                                  ^
../go/src/golang.org/x/net/internal/socket/sys_linux.go:21:34: error: reference to undefined name ‘sysSENDMMSG’
   21 |  n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
      |                                  ^
../go/src/golang.org/x/net/internal/socket/sys_posix.go:35:21: error: reference to undefined name ‘sizeofSockaddrInet’
   35 |   b := make([]byte, sizeofSockaddrInet)
      |                     ^
../go/src/golang.org/x/net/internal/socket/sys_posix.go:35:21: error: non-integer len argument in make
../go/src/golang.org/x/net/internal/socket/sys_posix.go:40:11: error: reference to undefined name ‘sizeofSockaddrInet’
   40 |    b[0] = sizeofSockaddrInet
      |           ^
../go/src/golang.org/x/net/internal/socket/sys_posix.go:48:21: error: reference to undefined name ‘sizeofSockaddrInet6’
   48 |   b := make([]byte, sizeofSockaddrInet6)
      |                     ^
../go/src/golang.org/x/net/internal/socket/sys_posix.go:48:21: error: non-integer len argument in make
../go/src/golang.org/x/net/internal/socket/sys_posix.go:53:11: error: reference to undefined name ‘sizeofSockaddrInet6’
   53 |    b[0] = sizeofSockaddrInet6
      |           ^
../go/src/golang.org/x/net/internal/socket/sys_posix.go:80:15: error: reference to undefined name ‘sizeofSockaddrInet’
   80 |   if len(b) < sizeofSockaddrInet {
      |               ^
../go/src/golang.org/x/net/internal/socket/sys_posix.go:87:15: error: reference to undefined name ‘sizeofSockaddrInet6’
   87 |   if len(b) < sizeofSockaddrInet6 {
      |               ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:16:16: error: use of undefined type ‘iovec’
   16 |   vs := make([]iovec, len(ms[i].Buffers))
      |                ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:12:17: error: use of undefined type ‘mmsghdr’
   12 | type mmsghdrs []mmsghdr
      |                 ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:12:17: error: use of undefined type ‘mmsghdr’
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:16:16: error: use of undefined type ‘iovec’
   16 |   vs := make([]iovec, len(ms[i].Buffers))
      |                ^
../go/src/golang.org/x/net/internal/socket/mmsghdr_unix.go:16:16: error: use of undefined type ‘iovec’
(null):0: confused by earlier errors, bailing out
@gopherbot gopherbot added this to the Gccgo milestone Apr 21, 2021
@ianlancetaylor
Copy link
Contributor

I feel like this is somewhat dependent on #37443, which I stalled out on.

@bwh-mind
Copy link
Author

@ianlancetaylor I just submitted a PR for that

@ianlancetaylor
Copy link
Contributor

I see that now, thanks for working on it.

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 21, 2021
@ianlancetaylor ianlancetaylor modified the milestones: Gccgo, Unreleased Apr 21, 2021
bwh-mind added a commit to bwh-mind/golang-net that referenced this issue Apr 22, 2021
Add the generated structure definitions for linux/ppc.  This file was
created using gccgo 10.2.1 and the command:

    GOARCH=ppc CC=powerpc-linux-gnu-gcc go tool cgo -godefs defs_linux.go

Fixes golang/go#45677
@gopherbot
Copy link

Change https://golang.org/cl/312710 mentions this issue: internal/socket: add ppc system call definitions, for use with gccgo

@golang golang locked and limited conversation to collaborators Apr 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants