summaryrefslogtreecommitdiff
path: root/libgo/go/syscall
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-04 22:39:30 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-04 22:39:30 +0000
commit141eb62b271e86f160340936655dfbc302b31356 (patch)
tree770354d65e888c2d5026ac0f9759649f58da3104 /libgo/go/syscall
parentb41c650b1b57b1f77b9bafdb3bcfa36b132ce0e0 (diff)
downloadgcc-141eb62b271e86f160340936655dfbc302b31356.tar.gz
libgo: add s390 support
From Dominik Vogt. * libgo/go/syscall/libcall_linux_s390.go: New file for s390 support. * libgo/go/syscall/syscall_linux_s390.go: Ditto. * libgo/go/syscall/libcall_linux_s390x.go: New file for s390x support. * libgo/go/syscall/syscall_linux_s390x.go: Ditto. * libgo/go/runtime/pprof/pprof.go (printStackRecord): Support s390 and s390x. * libgo/runtime/runtime.c (runtime_cputicks): Add support for s390 and s390x * libgo/mksysinfo.sh: Ditto. (upcase_fields): New helper function * libgo/go/debug/elf/file.go (applyRelocations): Implement relocations on s390x. (applyRelocationsS390x): Ditto. (DWARF): Ditto. * libgo/go/debug/elf/elf.go (R_390): New constants for S390 relocations. (r390Strings): Ditto. (String): Helper function for S390 relocations. (GoString): Ditto. * libgo/go/reflect/makefuncgo_s390.go: New file. (S390MakeFuncStubGo): Implementation of s390 abi. * libgo/go/reflect/makefuncgo_s390x.go: New file. (S390xMakeFuncStubGo): Implementation of s390x abi. * libgo/go/reflect/makefunc_s390.c: New file. (makeFuncStub): s390 and s390x specific implementation of function. * libgo/go/reflect/makefunc.go (MakeFunc): Add support for s390 and s390x. (makeMethodValue): Ditto. (makeValueMethod): Ditto. * libgo/Makefile.am (go_reflect_makefunc_s_file): Ditto. (go_reflect_makefunc_file): Ditto. * libgo/go/reflect/makefunc_dummy.c: Ditto. * libgo/runtime/runtime.h (__go_makefunc_can_recover): Export prototype for use in makefunc_s390.c. (__go_makefunc_returning): Ditto. * libgo/go/syscall/exec_linux.go (forkAndExecInChild): Fix order of the arguments of the clone system call for s390[x]. * libgo/configure.ac (is_s390): New variable. (is_s390x): Ditto (LIBGO_IS_S390): Ditto. (LIBGO_IS_S390X): Ditto. (GOARCH): Support s390 and s390x. * libgo/go/go/build/build.go (cgoEnabled): Ditto. * libgo/go/go/build/syslist.go (goarchList): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217106 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/syscall')
-rw-r--r--libgo/go/syscall/exec_linux.go7
-rw-r--r--libgo/go/syscall/libcall_linux_s390.go7
-rw-r--r--libgo/go/syscall/libcall_linux_s390x.go7
-rw-r--r--libgo/go/syscall/syscall_linux_s390.go21
-rw-r--r--libgo/go/syscall/syscall_linux_s390x.go21
5 files changed, 62 insertions, 1 deletions
diff --git a/libgo/go/syscall/exec_linux.go b/libgo/go/syscall/exec_linux.go
index 6a92163206b..2371902cbaa 100644
--- a/libgo/go/syscall/exec_linux.go
+++ b/libgo/go/syscall/exec_linux.go
@@ -7,6 +7,7 @@
package syscall
import (
+ "runtime"
"unsafe"
)
@@ -65,7 +66,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// About to call fork.
// No more allocation or calls of non-assembly functions.
runtime_BeforeFork()
- r1, _, err1 = RawSyscall6(SYS_CLONE, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0)
+ if runtime.GOARCH == "s390x" || runtime.GOARCH == "s390" {
+ r1, _, err1 = RawSyscall6(SYS_CLONE, 0, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0)
+ } else {
+ r1, _, err1 = RawSyscall6(SYS_CLONE, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0, 0)
+ }
if err1 != 0 {
runtime_AfterFork()
return 0, err1
diff --git a/libgo/go/syscall/libcall_linux_s390.go b/libgo/go/syscall/libcall_linux_s390.go
new file mode 100644
index 00000000000..c5f3b30ffd3
--- /dev/null
+++ b/libgo/go/syscall/libcall_linux_s390.go
@@ -0,0 +1,7 @@
+// Copyright 2014 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.
+
+// GNU/Linux library calls s390 specific.
+
+package syscall
diff --git a/libgo/go/syscall/libcall_linux_s390x.go b/libgo/go/syscall/libcall_linux_s390x.go
new file mode 100644
index 00000000000..c5f3b30ffd3
--- /dev/null
+++ b/libgo/go/syscall/libcall_linux_s390x.go
@@ -0,0 +1,7 @@
+// Copyright 2014 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.
+
+// GNU/Linux library calls s390 specific.
+
+package syscall
diff --git a/libgo/go/syscall/syscall_linux_s390.go b/libgo/go/syscall/syscall_linux_s390.go
new file mode 100644
index 00000000000..a744f6b7841
--- /dev/null
+++ b/libgo/go/syscall/syscall_linux_s390.go
@@ -0,0 +1,21 @@
+// syscall_linux_s390.go -- GNU/Linux s390 specific support
+
+// Copyright 2014 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"
+
+func (r *PtraceRegs) PC() uint64 { return uint64(r.Psw.Addr) }
+
+func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = uint32(pc) }
+
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
+ return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
+}
+
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
+ return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
+}
diff --git a/libgo/go/syscall/syscall_linux_s390x.go b/libgo/go/syscall/syscall_linux_s390x.go
new file mode 100644
index 00000000000..44d567983c8
--- /dev/null
+++ b/libgo/go/syscall/syscall_linux_s390x.go
@@ -0,0 +1,21 @@
+// syscall_linux_s390x.go -- GNU/Linux s390x specific support
+
+// Copyright 2014 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"
+
+func (r *PtraceRegs) PC() uint64 { return r.Psw.Addr }
+
+func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = pc }
+
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
+ return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
+}
+
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
+ return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
+}