Commit 7155702f authored by Lynn Boger's avatar Lynn Boger Committed by Tobias Klauser

unix: fix errors in syscalls when using -linkshared on ppc64x

When using -linkshared, the external linker on ppc64x cannot
always handle the direct branch to syscall.Syscall and similar
similar functions when the offset is too far. Instead it should
be done as a BL which can then be called through a procedure
linkage table entry.

This change removes functions Syscall, Syscall6,
RawSyscall, RawSyscall6 from asm_linux_ppc64x.s and instead
creates Go functions which call their corresponding
functions in the syscall package. As Go functions, they can be
inlined with the help of CL 147361.

Fixes golang/go#16662

Change-Id: Ibd2b6ec15b0781c3d7db25e249a3ffc9e1c2884b
Reviewed-on: https://go-review.googlesource.com/c/146518
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarTobias Klauser <tobias.klauser@gmail.com>
parent 9b800f95
...@@ -15,12 +15,6 @@ ...@@ -15,12 +15,6 @@
// Just jump to package syscall's implementation for all these functions. // Just jump to package syscall's implementation for all these functions.
// The runtime may know about them. // The runtime may know about them.
TEXT ·Syscall(SB),NOSPLIT,$0-56
BR syscall·Syscall(SB)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
BR syscall·Syscall6(SB)
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
BL runtime·entersyscall(SB) BL runtime·entersyscall(SB)
MOVD a1+8(FP), R3 MOVD a1+8(FP), R3
...@@ -36,12 +30,6 @@ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 ...@@ -36,12 +30,6 @@ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
BL runtime·exitsyscall(SB) BL runtime·exitsyscall(SB)
RET RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
BR syscall·RawSyscall(SB)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
BR syscall·RawSyscall6(SB)
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
MOVD a1+8(FP), R3 MOVD a1+8(FP), R3
MOVD a2+16(FP), R4 MOVD a2+16(FP), R4
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris
// +build !gccgo // +build !gccgo,!ppc64le,!ppc64
package unix package unix
......
// 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.
// +build linux
// +build ppc64le ppc64
// +build !gccgo
package unix
import "syscall"
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
return syscall.Syscall(trap, a1, a2, a3)
}
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6)
}
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
return syscall.RawSyscall(trap, a1, a2, a3)
}
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment