Repository: go
Issue: gccgo: GOPATH=/opt/go_pkgs go get -v golang.org/x/sys/... fails
Labels: OS-Solaris,NeedsFix

### What version of Go are you using (`go version`)?
`go version go1.10.3 gccgo (GCC) 8.2.1 20180813 solaris/sparc
`
### Does this issue reproduce with the latest release?
`yes (gccgo compiled from source)
`
### What operating system and processor architecture are you using (`go env`)?
```
amandeep@s113ldom1:~/workspace/main$ ago env
-bash: ago: command not found
amandeep@s113ldom1:~/workspace/main$ ago ^C
amandeep@s113ldom1:~/workspace/main$ go env
GOARCH="sparc"
GOBIN=""
GOCACHE="/home/amandeep/.cache/go-build"
GOEXE=""
GOHOSTARCH="sparc"
GOHOSTOS="solaris"
GOOS="solaris"
GOPATH="/opt/go_pkgs/"
GORACE=""
GOROOT="/usr/gnu"
GOTMPDIR=""
GOTOOLDIR="/usr/gnu/libexec/gcc/sparc-sun-solaris2.11/8.2.1"
GCCGO="/usr/gnu/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build275813452=/tmp/go-build -gno-record-gcc-switches -funwind-tables"
```

### What did you do?
`sudo GOPATH=/opt/go_pkgs go get -v golang.org/x/sys/...`

### What did you expect to see?
package to install


### What did you see instead?
this is how the prompt looks:

```
amandeep@s113ldom1:~/workspace/main$ sudo GOPATH=/opt/go_pkgs go get -v golang.org/x/sys/...
golang.org/x/sys/cpu
golang.org/x/sys/windows
golang.org/x/sys/unix
golang.org/x/sys/windows/registry
# golang.org/x/sys/cpu
/opt/go_pkgs/src/golang.org/x/sys/cpu/cpu.go:10:30: error: reference to undefined name ‘cacheLineSize’
 type CacheLinePad struct{ _ [cacheLineSize]byte }
                              ^
# golang.org/x/sys/unix
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:15:12: error: reference to undefined name ‘sizeofPtr’
  salign := sizeofPtr
            ^
/opt/go_pkgs/src/golang.org/x/sys/unix/syscall_unix.go:25:47: error: reference to undefined name ‘sizeofPtr’
  darwin64Bit    = runtime.GOOS == "darwin" && sizeofPtr == 8
                                               ^
/opt/go_pkgs/src/golang.org/x/sys/unix/syscall_unix.go:26:50: error: reference to undefined name ‘sizeofPtr’
  dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
                                                  ^
/opt/go_pkgs/src/golang.org/x/sys/unix/syscall_unix.go:28:48: error: reference to undefined name ‘sizeofPtr’
  solaris64Bit   = runtime.GOOS == "solaris" && sizeofPtr == 8
                                                ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:28:21: error: reference to undefined name ‘SizeofCmsghdr’
  return cmsgAlignOf(SizeofCmsghdr) + datalen
                     ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:34:21: error: reference to undefined name ‘SizeofCmsghdr’
  return cmsgAlignOf(SizeofCmsghdr) + cmsgAlignOf(datalen)
                     ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:38:73: error: reference to undefined name ‘SizeofCmsghdr’
  return unsafe.Pointer(uintptr(unsafe.Pointer(h)) + uintptr(cmsgAlignOf(SizeofCmsghdr)))
                                                                         ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:37:18: error: use of undefined type ‘Cmsghdr’
 func cmsgData(h *Cmsghdr) unsafe.Pointer {
                  ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:59:25: error: reference to field ‘Len’ in object which has no fields or methods
   i += cmsgAlignOf(int(h.Len))
                         ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:65:9: error: reference to undefined name ‘Cmsghdr’
  h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
         ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:65:8: error: expected pointer
  h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
        ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:66:13: error: reference to undefined name ‘SizeofCmsghdr’
  if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
             ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:67:20: error: reference to undefined name ‘EINVAL’
   return nil, nil, EINVAL
                    ^
/opt/go_pkgs/src/golang.org/x/sys/unix/sockcmsg_unix.go:69:26: error: reference to undefined name ‘SizeofCmsghdr’
  return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil

and many more......

```