summaryrefslogtreecommitdiff
path: root/system/gcc/338-gccgo-syscall.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-04-25 06:18:22 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-04-25 06:18:22 +0000
commitd40d77c4b8e84ab22bb631c5cced89b10ce3a84c (patch)
treecb2df669b217dbac7250cea6357a2c8be5cbfbea /system/gcc/338-gccgo-syscall.patch
parente179c8bab629eb4f1ceb840ef6eed33c4d4c553b (diff)
downloadpackages-d40d77c4b8e84ab22bb631c5cced89b10ce3a84c.tar.gz
packages-d40d77c4b8e84ab22bb631c5cced89b10ce3a84c.tar.bz2
packages-d40d77c4b8e84ab22bb631c5cced89b10ce3a84c.tar.xz
packages-d40d77c4b8e84ab22bb631c5cced89b10ce3a84c.zip
system/gcc: fix more GCC Go bugs
Diffstat (limited to 'system/gcc/338-gccgo-syscall.patch')
-rw-r--r--system/gcc/338-gccgo-syscall.patch115
1 files changed, 115 insertions, 0 deletions
diff --git a/system/gcc/338-gccgo-syscall.patch b/system/gcc/338-gccgo-syscall.patch
new file mode 100644
index 000000000..a4ecb5b6b
--- /dev/null
+++ b/system/gcc/338-gccgo-syscall.patch
@@ -0,0 +1,115 @@
+diff -Naur gcc-8.3.0-orig/libgo/go/runtime/stubs.go gcc-8.3.0/libgo/go/runtime/stubs.go
+--- gcc-8.3.0-orig/libgo/go/runtime/stubs.go 2019-04-25 03:03:52.311215191 +0000
++++ gcc-8.3.0/libgo/go/runtime/stubs.go 2019-04-25 03:03:27.973824045 +0000
+@@ -284,8 +284,7 @@
+ // For gccgo this is in the C code.
+ func osyield()
+
+-// For gccgo this can be called directly.
+-//extern syscall
++//extern __go_syscall6
+ func syscall(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr
+
+ // For gccgo, to communicate from the C code to the Go code.
+diff -Naur gcc-8.3.0-orig/libgo/go/syscall/syscall_unix.go gcc-8.3.0/libgo/go/syscall/syscall_unix.go
+--- gcc-8.3.0-orig/libgo/go/syscall/syscall_unix.go 2019-04-25 03:04:55.064488337 +0000
++++ gcc-8.3.0/libgo/go/syscall/syscall_unix.go 2019-04-25 03:08:23.612133013 +0000
+@@ -19,11 +19,8 @@
+ Stderr = 2
+ )
+
+-//extern syscall
+-func c_syscall32(trap int32, a1, a2, a3, a4, a5, a6 int32) int32
+-
+-//extern syscall
+-func c_syscall64(trap int64, a1, a2, a3, a4, a5, a6 int64) int64
++//extern __go_syscall6
++func syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) uintptr
+
+ const (
+ darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
+@@ -38,14 +35,7 @@
+ func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+ Entersyscall()
+ SetErrno(0)
+- var r uintptr
+- if unsafe.Sizeof(r) == 4 {
+- r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), 0, 0, 0)
+- r = uintptr(r1)
+- } else {
+- r1 := c_syscall64(int64(trap), int64(a1), int64(a2), int64(a3), 0, 0, 0)
+- r = uintptr(r1)
+- }
++ r := syscall6(trap, a1, a2, a3, 0, 0, 0)
+ err = GetErrno()
+ Exitsyscall()
+ return r, 0, err
+@@ -54,47 +44,22 @@
+ func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
+ Entersyscall()
+ SetErrno(0)
+- var r uintptr
+- if unsafe.Sizeof(r) == 4 {
+- r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3),
+- int32(a4), int32(a5), int32(a6))
+- r = uintptr(r1)
+- } else {
+- r1 := c_syscall64(int64(trap), int64(a1), int64(a2), int64(a3),
+- int64(a4), int64(a5), int64(a6))
+- r = uintptr(r1)
+- }
++ 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) {
+- var r uintptr
+ SetErrno(0)
+- if unsafe.Sizeof(r) == 4 {
+- r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3), 0, 0, 0)
+- r = uintptr(r1)
+- } else {
+- r1 := c_syscall64(int64(trap), int64(a1), int64(a2), int64(a3), 0, 0, 0)
+- r = uintptr(r1)
+- }
++ 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) {
+- var r uintptr
+ SetErrno(0)
+- if unsafe.Sizeof(r) == 4 {
+- r1 := c_syscall32(int32(trap), int32(a1), int32(a2), int32(a3),
+- int32(a4), int32(a5), int32(a6))
+- r = uintptr(r1)
+- } else {
+- r1 := c_syscall64(int64(trap), int64(a1), int64(a2), int64(a3),
+- int64(a4), int64(a5), int64(a6))
+- r = uintptr(r1)
+- }
++ r := syscall6(trap, a1, a2, a3, a4, a5, a6)
+ err = GetErrno()
+ return r, 0, err
+ }
+diff -Naur gcc-8.3.0-orig/libgo/runtime/go-varargs.c gcc-8.3.0/libgo/runtime/go-varargs.c
+--- gcc-8.3.0-orig/libgo/runtime/go-varargs.c 2015-11-06 19:15:45.000000000 +0000
++++ gcc-8.3.0/libgo/runtime/go-varargs.c 2019-04-25 03:14:11.404851275 +0000
+@@ -89,3 +89,14 @@
+ }
+
+ #endif
++
++// __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.
++
++uintptr_t
++__go_syscall6(uintptr_t flag, uintptr_t a1, uintptr_t a2, uintptr_t a3,
++ uintptr_t a4, uintptr_t a5, uintptr_t a6)
++{
++ return syscall (flag, a1, a2, a3, a4, a5, a6);
++}