This patch by Clément Chigot fixes the AIX support after the update to
Go 1.12.  Bootstrapped and ran Go tests on x86_64-pc-linux-gnu.
Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 269780)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-87945b620b2100d33e27f33e6276a4e4e5890659
+069afe85f38c099660c5d81950d65248ed4fc516
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/archive/tar/stat_actime1.go
===================================================================
--- libgo/go/archive/tar/stat_actime1.go        (revision 269619)
+++ libgo/go/archive/tar/stat_actime1.go        (working copy)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build hurd linux dragonfly openbsd solaris
+// +build aix hurd linux dragonfly openbsd solaris
 
 package tar
 
Index: libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go
===================================================================
--- libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go     
(revision 269619)
+++ libgo/go/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go     
(working copy)
@@ -35,7 +35,9 @@ const (
        writeLock lockType = syscall.F_WRLCK
 )
 
-type inode = uint64 // type of syscall.Stat_t.Ino
+// type of syscall.Stat_t.Ino for 64 bits architectures.
+// For 32 bits architecture, it's easier to cast it instead.
+type inode = uint64
 
 type inodeLock struct {
        owner File
@@ -59,7 +61,7 @@ func lock(f File, lt lockType) (err erro
        if err != nil {
                return err
        }
-       ino := fi.Sys().(*syscall.Stat_t).Ino
+       ino := uint64(fi.Sys().(*syscall.Stat_t).Ino)
 
        mu.Lock()
        if i, dup := inodes[f]; dup && i != ino {
Index: libgo/go/internal/syscall/unix/at_largefile.go
===================================================================
--- libgo/go/internal/syscall/unix/at_largefile.go      (revision 269619)
+++ libgo/go/internal/syscall/unix/at_largefile.go      (working copy)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build aix hurd linux solaris,386 solaris,sparc
+// +build hurd linux solaris,386 solaris,sparc
 
 package unix
 
Index: libgo/go/internal/syscall/unix/at_regfile.go
===================================================================
--- libgo/go/internal/syscall/unix/at_regfile.go        (revision 269619)
+++ libgo/go/internal/syscall/unix/at_regfile.go        (working copy)
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !aix
 // +build !hurd
 // +build !linux
 // +build !solaris !386
Index: libgo/go/internal/syscall/unix/ioctl_aix.go
===================================================================
--- libgo/go/internal/syscall/unix/ioctl_aix.go (revision 269619)
+++ libgo/go/internal/syscall/unix/ioctl_aix.go (working copy)
@@ -9,17 +9,12 @@ import (
        "unsafe"
 )
 
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.a/shr_64.o"
-//go:linkname libc_ioctl libc_ioctl
-var libc_ioctl uintptr
-
-// Implemented in syscall/syscall_aix.go.
-func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, 
err syscall.Errno)
+//extern __go_ioctl_ptr
+func ioctl(int32, int32, unsafe.Pointer) int32
 
 func Ioctl(fd int, cmd int, args uintptr) (err error) {
-       _, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_ioctl)), 3, 
uintptr(fd), uintptr(cmd), uintptr(args), 0, 0, 0)
-       if e1 != 0 {
-               err = e1
+       if ioctl(int32(fd), int32(cmd), unsafe.Pointer(args)) < 0 {
+               return syscall.GetErrno()
        }
        return
 }
Index: libgo/go/net/interface_aix.go
===================================================================
--- libgo/go/net/interface_aix.go       (revision 269619)
+++ libgo/go/net/interface_aix.go       (working copy)
@@ -32,6 +32,8 @@ const _RTAX_NETMASK = 2
 const _RTAX_IFA = 5
 const _RTAX_MAX = 8
 
+const _SIOCGIFMTU = -0x3fd796aa
+
 func getIfList() ([]byte, error) {
        needed, err := syscall.Getkerninfo(_KINFO_RT_IFLIST, 0, 0, 0)
        if err != nil {
@@ -62,7 +64,7 @@ func interfaceTable(ifindex int) ([]Inte
                }
                if ifm.Type == syscall.RTM_IFINFO {
                        if ifindex == 0 || ifindex == int(ifm.Index) {
-                               sdl := 
(*rawSockaddrDatalink)(unsafe.Pointer(&tab[syscall.SizeofIfMsghdr]))
+                               sdl := 
(*rawSockaddrDatalink)(unsafe.Pointer(&tab[unsafe.Sizeof(syscall.IfMsgHdr)]))
 
                                ifi := &Interface{Index: int(ifm.Index), Flags: 
linkFlags(ifm.Flags)}
                                ifi.Name = string(sdl.Data[:sdl.Nlen])
@@ -75,7 +77,7 @@ func interfaceTable(ifindex int) ([]Inte
                                if err != nil {
                                        return nil, err
                                }
-                               err = unix.Ioctl(sock, syscall.SIOCGIFMTU, 
uintptr(unsafe.Pointer(ifr)))
+                               err = unix.Ioctl(sock, _SIOCGIFMTU, 
uintptr(unsafe.Pointer(ifr)))
                                if err != nil {
                                        return nil, err
                                }
@@ -131,7 +133,7 @@ func interfaceAddrTable(ifi *Interface)
                if ifm.Type == syscall.RTM_NEWADDR {
                        if ifi == nil || ifi.Index == int(ifm.Index) {
                                mask := ifm.Addrs
-                               off := uint(syscall.SizeofIfMsghdr)
+                               off := uint(unsafe.Sizeof(syscall.IfMsgHdr))
 
                                var iprsa, nmrsa *syscall.RawSockaddr
                                for i := uint(0); i < _RTAX_MAX; i++ {
Index: libgo/go/net/interface_stub.go
===================================================================
--- libgo/go/net/interface_stub.go      (revision 269619)
+++ libgo/go/net/interface_stub.go      (working copy)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build aix nacl hurd js,wasm
+// +build nacl hurd js,wasm
 
 package net
 
Index: libgo/go/net/sockoptip_aix.go
===================================================================
--- libgo/go/net/sockoptip_aix.go       (revision 269619)
+++ libgo/go/net/sockoptip_aix.go       (nonexistent)
@@ -1,15 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package net
-
-import "syscall"
-
-func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
-       return syscall.ENOPROTOOPT
-}
-
-func setIPv4MulticastLoopback(fd *netFD, v bool) error {
-       return syscall.ENOPROTOOPT
-}
Index: libgo/go/os/dir_gccgo.go
===================================================================
--- libgo/go/os/dir_gccgo.go    (revision 269619)
+++ libgo/go/os/dir_gccgo.go    (working copy)
@@ -16,9 +16,6 @@ import (
 //extern pathconf
 func libc_pathconf(*byte, int) int
 
-//extern fdopendir
-func libc_fdopendir(int32) *syscall.DIR
-
 func clen(n []byte) int {
        for i := 0; i < len(n); i++ {
                if n[i] == 0 {
Index: libgo/go/os/dir_libc64_gccgo.go
===================================================================
--- libgo/go/os/dir_libc64_gccgo.go     (revision 269619)
+++ libgo/go/os/dir_libc64_gccgo.go     (working copy)
@@ -10,3 +10,6 @@ import "syscall"
 
 //extern closedir64
 func libc_closedir(*syscall.DIR) int
+
+//extern fdopendir64
+func libc_fdopendir(int32) *syscall.DIR
Index: libgo/go/os/dir_libc_gccgo.go
===================================================================
--- libgo/go/os/dir_libc_gccgo.go       (revision 269619)
+++ libgo/go/os/dir_libc_gccgo.go       (working copy)
@@ -10,3 +10,6 @@ import "syscall"
 
 //extern closedir
 func libc_closedir(*syscall.DIR) int
+
+//extern fdopendir
+func libc_fdopendir(int32) *syscall.DIR
Index: libgo/go/os/sys_aix.go
===================================================================
--- libgo/go/os/sys_aix.go      (revision 269619)
+++ libgo/go/os/sys_aix.go      (nonexistent)
@@ -1,26 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package os
-
-import "syscall"
-
-// gethostname syscall cannot be used because it also returns the domain.
-// Therefore, hostname is retrieve with uname syscall and the Nodename field.
-
-func hostname() (name string, err error) {
-       var u syscall.Utsname
-       if errno := syscall.Uname(&u); errno != nil {
-               return "", NewSyscallError("uname", errno)
-       }
-       b := make([]byte, len(u.Nodename))
-       i := 0
-       for ; i < len(u.Nodename); i++ {
-               if u.Nodename[i] == 0 {
-                       break
-               }
-               b[i] = byte(u.Nodename[i])
-       }
-       return string(b[:i]), nil
-}
Index: libgo/go/runtime/malloc.go
===================================================================
--- libgo/go/runtime/malloc.go  (revision 269619)
+++ libgo/go/runtime/malloc.go  (working copy)
@@ -218,7 +218,7 @@ const (
        // we further limit it to 31 bits.
        //
        // WebAssembly currently has a limit of 4GB linear memory.
-       heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-sys.GoosAix))*48 + 
(1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 
60*sys.GoosAix
+       heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-sys.GoosAix))*48 + 
(1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 
60*(sys.GoosAix*_64bit)
 
        // maxAlloc is the maximum size of an allocation. On 64-bit,
        // it's theoretically possible to allocate 1<<heapAddrBits bytes. On
@@ -259,7 +259,7 @@ const (
        // logHeapArenaBytes is log_2 of heapArenaBytes. For clarity,
        // prefer using heapArenaBytes where possible (we need the
        // constant to compute some other constants).
-       logHeapArenaBytes = (6+20)*(_64bit*(1-sys.GoosWindows)*(1-sys.GoosAix)) 
+ (2+20)*(_64bit*sys.GoosWindows) + (2+20)*(1-_64bit) + (8+20)*sys.GoosAix
+       logHeapArenaBytes = (6+20)*(_64bit*(1-sys.GoosWindows)*(1-sys.GoosAix)) 
+ (2+20)*(_64bit*sys.GoosWindows) + (2+20)*(1-_64bit) + 
(8+20)*(sys.GoosAix*_64bit)
 
        // heapArenaBitmapBytes is the size of each heap arena's bitmap.
        heapArenaBitmapBytes = heapArenaBytes / (sys.PtrSize * 8 / 2)
@@ -282,7 +282,7 @@ const (
        //
        // We use the L1 map on aix/ppc64 to keep the same L2 value
        // as on Linux.
-       arenaL1Bits = 6*(_64bit*sys.GoosWindows) + 12*sys.GoosAix
+       arenaL1Bits = 6*(_64bit*sys.GoosWindows) + 12*(sys.GoosAix*_64bit)
 
        // arenaL2Bits is the number of bits of the arena number
        // covered by the second level arena index.
Index: libgo/go/runtime/mem_gccgo.go
===================================================================
--- libgo/go/runtime/mem_gccgo.go       (revision 269619)
+++ libgo/go/runtime/mem_gccgo.go       (working copy)
@@ -187,6 +187,11 @@ func sysReserve(v unsafe.Pointer, n uint
 func sysMap(v unsafe.Pointer, n uintptr, sysStat *uint64) {
        mSysStatInc(sysStat, n)
 
+       if GOOS == "aix" {
+               // AIX does not allow mapping a range that is already mapped.
+               // So always unmap first even if it is already unmapped.
+               munmap(v, n)
+       }
        p, err := mmap(v, n, _PROT_READ|_PROT_WRITE, 
_MAP_ANON|_MAP_FIXED|_MAP_PRIVATE, mmapFD, 0)
        if err == _ENOMEM {
                throw("runtime: out of memory")
Index: libgo/go/runtime/netpoll_aix.go
===================================================================
--- libgo/go/runtime/netpoll_aix.go     (revision 269619)
+++ libgo/go/runtime/netpoll_aix.go     (working copy)
@@ -37,7 +37,6 @@ const _POLLIN = 0x0001
 const _POLLOUT = 0x0002
 const _POLLHUP = 0x2000
 const _POLLERR = 0x4000
-const _O_NONBLOCK = 0x4
 
 var (
        pfds           []pollfd
Index: libgo/go/runtime/os_aix.go
===================================================================
--- libgo/go/runtime/os_aix.go  (revision 269619)
+++ libgo/go/runtime/os_aix.go  (working copy)
@@ -62,12 +62,19 @@ func semasleep(ns int64) int32 {
                if clock_gettime(_CLOCK_REALTIME, &ts) != 0 {
                        throw("clock_gettime")
                }
-               ts.tv_sec += ns / 1e9
-               ts.tv_nsec += ns % 1e9
-               if ts.tv_nsec >= 1e9 {
-                       ts.tv_sec++
-                       ts.tv_nsec -= 1e9
+
+               sec := int64(ts.tv_sec) + ns/1e9
+               nsec := int64(ts.tv_nsec) + ns%1e9
+               if nsec >= 1e9 {
+                       sec++
+                       nsec -= 1e9
+               }
+               if sec != int64(timespec_sec_t(sec)) {
+                       // Handle overflows (timespec_sec_t is 32-bit in 32-bit 
applications)
+                       sec = 1<<31 - 1
                }
+               ts.tv_sec = timespec_sec_t(sec)
+               ts.tv_nsec = timespec_nsec_t(nsec)
 
                if sem_timedwait((*semt)(unsafe.Pointer(_m_.mos.waitsema)), 
&ts) != 0 {
                        err := errno()
Index: libgo/go/runtime/stubs2.go
===================================================================
--- libgo/go/runtime/stubs2.go  (revision 269619)
+++ libgo/go/runtime/stubs2.go  (working copy)
@@ -7,7 +7,6 @@
 // +build !nacl
 // +build !js
 // +build !darwin
-// +build !aix
 
 package runtime
 
Index: libgo/go/runtime/timestub2.go
===================================================================
--- libgo/go/runtime/timestub2.go       (revision 269619)
+++ libgo/go/runtime/timestub2.go       (working copy)
@@ -5,8 +5,6 @@
 // +build !darwin
 // +build !windows
 // +build !freebsd
-// +build !aix
-
 package runtime
 
 func walltime() (sec int64, nsec int32)
Index: libgo/go/syscall/exec_aix_test.go
===================================================================
--- libgo/go/syscall/exec_aix_test.go   (revision 269619)
+++ libgo/go/syscall/exec_aix_test.go   (nonexistent)
@@ -1,37 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix
-
-package syscall
-
-import "unsafe"
-
-//go:cgo_import_dynamic libc_Getpgid getpgid "libc.a/shr_64.o"
-//go:cgo_import_dynamic libc_Getpgrp getpgrp "libc.a/shr_64.o"
-
-//go:linkname libc_Getpgid libc_Getpgid
-//go:linkname libc_Getpgrp libc_Getpgrp
-
-var (
-       libc_Getpgid,
-       libc_Getpgrp libcFunc
-)
-
-func Getpgid(pid int) (pgid int, err error) {
-       r0, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_Getpgid)), 1, 
uintptr(pid), 0, 0, 0, 0, 0)
-       pgid = int(r0)
-       if e1 != 0 {
-               err = e1
-       }
-       return
-}
-
-func Getpgrp() (pgrp int) {
-       r0, _, _ := syscall6(uintptr(unsafe.Pointer(&libc_Getpgrp)), 0, 0, 0, 
0, 0, 0, 0)
-       pgrp = int(r0)
-       return
-}
-
-var Ioctl = ioctl
Index: libgo/go/syscall/exec_unix.go
===================================================================
--- libgo/go/syscall/exec_unix.go       (revision 269619)
+++ libgo/go/syscall/exec_unix.go       (working copy)
@@ -299,7 +299,6 @@ func runtime_AfterExec()
 
 // execveLibc is non-nil on OS using libc syscall, set to execve in 
exec_libc.go; this
 // avoids a build dependency for other platforms.
-var execveLibc func(path uintptr, argv uintptr, envp uintptr) Errno
 var execveDarwin func(path *byte, argv **byte, envp **byte) error
 
 // Exec invokes the execve(2) system call.
@@ -321,10 +320,7 @@ func Exec(argv0 string, argv []string, e
        var err1 error
        if runtime.GOOS == "solaris" || runtime.GOOS == "aix" || runtime.GOOS 
== "hurd" {
                // RawSyscall should never be used on Solaris or AIX.
-               err1 = execveLibc(
-                       uintptr(unsafe.Pointer(argv0p)),
-                       uintptr(unsafe.Pointer(&argvp[0])),
-                       uintptr(unsafe.Pointer(&envvp[0])))
+               err1 = raw_execve(argv0p, &argvp[0], &envvp[0])
        } else if runtime.GOOS == "darwin" {
                // Similarly on Darwin.
                err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
Index: libgo/go/syscall/flock_aix.go
===================================================================
--- libgo/go/syscall/flock_aix.go       (revision 269619)
+++ libgo/go/syscall/flock_aix.go       (nonexistent)
@@ -1,18 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package syscall
-
-import "unsafe"
-
-// On AIX, there is no flock() system call.
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW 
command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) {
-       _, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, 
uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
Index: libgo/go/syscall/libcall_aix.go
===================================================================
--- libgo/go/syscall/libcall_aix.go     (revision 269619)
+++ libgo/go/syscall/libcall_aix.go     (working copy)
@@ -10,6 +10,9 @@ import (
        "unsafe"
 )
 
+// For exec_unix.go.
+const SYS_EXECVE = 0
+
 //sys  Openat(dirfd int, path string, flags int, mode uint32) (fd int, err 
error)
 //open64at(dirfd _C_int, path *byte, flags _C_int, mode Mode_t) _C_int
 
@@ -139,3 +142,6 @@ func ReadDirent(fd int, buf []byte) (n i
 func Unlinkat(dirfd int, path string) (err error) {
        return unlinkat(dirfd, path, 0)
 }
+
+//sys  Getkerninfo(op int32, where uintptr, size uintptr, arg int64) (i int32, 
err error)
+//getkerninfo(op _C_int, where *byte, size *byte, arg _C_long) _C_int
Index: libgo/go/syscall/syscall_funcs.go
===================================================================
--- libgo/go/syscall/syscall_funcs.go   (nonexistent)
+++ libgo/go/syscall/syscall_funcs.go   (working copy)
@@ -0,0 +1,45 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin dragonfly freebsd hurd linux netbsd openbsd solaris
+
+package syscall
+
+//extern __go_syscall6
+func syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr
+
+// Do a system call.  We look at the size of uintptr to see how to pass
+// the arguments, so that we don't pass a 64-bit value when the function
+// expects a 32-bit one.
+func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+       Entersyscall()
+       SetErrno(0)
+       r := syscall6(trap, a1, a2, a3, 0, 0, 0)
+       err = GetErrno()
+       Exitsyscall()
+       return r, 0, err
+}
+
+func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err 
Errno) {
+       Entersyscall()
+       SetErrno(0)
+       r := syscall6(trap, a1, a2, a3, a4, a5, a6)
+       err = GetErrno()
+       Exitsyscall()
+       return r, 0, err
+}
+
+func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+       SetErrno(0)
+       r := syscall6(trap, a1, a2, a3, 0, 0, 0)
+       err = GetErrno()
+       return r, 0, err
+}
+
+func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err 
Errno) {
+       SetErrno(0)
+       r := syscall6(trap, a1, a2, a3, a4, a5, a6)
+       err = GetErrno()
+       return r, 0, err
+}
Index: libgo/go/syscall/syscall_funcs_stubs.go
===================================================================
--- libgo/go/syscall/syscall_funcs_stubs.go     (nonexistent)
+++ libgo/go/syscall/syscall_funcs_stubs.go     (working copy)
@@ -0,0 +1,29 @@
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build aix rtems
+
+// These are stubs.
+
+package syscall
+
+func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+       z := -1
+       return uintptr(z), 0, ENOSYS
+}
+
+func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err 
Errno) {
+       z := -1
+       return uintptr(z), 0, ENOSYS
+}
+
+func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+       z := -1
+       return uintptr(z), 0, ENOSYS
+}
+
+func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err 
Errno) {
+       z := -1
+       return uintptr(z), 0, ENOSYS
+}
Index: libgo/go/syscall/syscall_stubs.go
===================================================================
--- libgo/go/syscall/syscall_stubs.go   (revision 269619)
+++ libgo/go/syscall/syscall_stubs.go   (nonexistent)
@@ -1,29 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build rtems
-
-// These are stubs.
-
-package syscall
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
-       z := -1
-       return uintptr(z), 0, uintptr(ENOSYS)
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
-       z := -1
-       return uintptr(z), 0, uintptr(ENOSYS)
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
-       z := -1
-       return uintptr(z), 0, uintptr(ENOSYS)
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
-       z := -1
-       return uintptr(z), 0, uintptr(ENOSYS)
-}
Index: libgo/go/syscall/syscall_unix.go
===================================================================
--- libgo/go/syscall/syscall_unix.go    (revision 269619)
+++ libgo/go/syscall/syscall_unix.go    (working copy)
@@ -19,9 +19,6 @@ var (
        Stderr = 2
 )
 
-//extern __go_syscall6
-func syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr
-
 const (
        darwin64Bit    = runtime.GOOS == "darwin" && sizeofPtr == 8
        dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
@@ -29,41 +26,6 @@ const (
        solaris64Bit   = runtime.GOOS == "solaris" && sizeofPtr == 8
 )
 
-// Do a system call.  We look at the size of uintptr to see how to pass
-// the arguments, so that we don't pass a 64-bit value when the function
-// expects a 32-bit one.
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
-       Entersyscall()
-       SetErrno(0)
-       r := syscall6(trap, a1, a2, a3, 0, 0, 0)
-       err = GetErrno()
-       Exitsyscall()
-       return r, 0, err
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err 
Errno) {
-       Entersyscall()
-       SetErrno(0)
-       r := syscall6(trap, a1, a2, a3, a4, a5, a6)
-       err = GetErrno()
-       Exitsyscall()
-       return r, 0, err
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
-       SetErrno(0)
-       r := syscall6(trap, a1, a2, a3, 0, 0, 0)
-       err = GetErrno()
-       return r, 0, err
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err 
Errno) {
-       SetErrno(0)
-       r := syscall6(trap, a1, a2, a3, a4, a5, a6)
-       err = GetErrno()
-       return r, 0, err
-}
-
 // clen returns the index of the first NULL byte in n or len(n) if n contains 
no NULL byte.
 func clen(n []byte) int {
        for i := 0; i < len(n); i++ {
Index: libgo/mksysinfo.sh
===================================================================
--- libgo/mksysinfo.sh  (revision 269619)
+++ libgo/mksysinfo.sh  (working copy)
@@ -1024,6 +1024,18 @@ grep '^type _ifinfomsg ' gen-sysinfo.go
       -e 's/ifi_change/Change/' \
     >> ${OUT}
 
+# The if_msghdr struct.
+grep '^type _if_msghdr ' gen-sysinfo.go | \
+    sed -e 's/_if_msghdr/IfMsgHdr/' \
+               -e 's/ifm_msglen/Msglen/' \
+               -e 's/ifm_version/Version/' \
+               -e 's/ifm_type/Type/' \
+               -e 's/ifm_addrs/Addrs/' \
+               -e 's/ifm_flags/Flags/' \
+               -e 's/ifm_index/Index/' \
+               -e 's/ifm_addrlen/Addrlen/' \
+               >> ${OUT}
+
 # The interface information types and flags.
 grep '^const _IFA' gen-sysinfo.go | \
     sed -e 's/^\(const \)_\(IFA[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
Index: libgo/runtime/go-varargs.c
===================================================================
--- libgo/runtime/go-varargs.c  (revision 269619)
+++ libgo/runtime/go-varargs.c  (working copy)
@@ -96,6 +96,8 @@ __go_openat (int fd, char *path, int fla
 
 #endif
 
+#ifdef HAVE_SYSCALL
+
 // __go_syscall6 is called by both the runtime and syscall packages.
 // We use uintptr_t to make sure that the types match, since the Go
 // and C "int" types are not the same.
@@ -106,3 +108,5 @@ __go_syscall6(uintptr_t flag, uintptr_t
 {
   return syscall (flag, a1, a2, a3, a4, a5, a6);
 }
+
+#endif

Reply via email to