diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-25 14:31:57 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-25 14:31:57 +0000 |
commit | f5ec13f15ddaa6dc61b81d5c14cd8b30df896b40 (patch) | |
tree | 2f3289c7aec8cfae51b453ebed7c32164270cfe1 /libgo/go/internal | |
parent | be2df8bc38a14659f6a5604c22252f17ef2a2a6c (diff) | |
download | gcc-f5ec13f15ddaa6dc61b81d5c14cd8b30df896b40.zip gcc-f5ec13f15ddaa6dc61b81d5c14cd8b30df896b40.tar.gz gcc-f5ec13f15ddaa6dc61b81d5c14cd8b30df896b40.tar.bz2 |
internal/bytealg, internal/cpu, internal/poll: portability fixes
In internal/bytealg correct a +build tag to never build indexbyte_generic.go
for the gofrontend, where we always use indexbyte_native.go.
For internal/cpu let the Makefile define CacheLineSize using goarch.sh,
rather than trying to enumerate all the possibilities in cpu_ARCH.go files.
In internal/poll call the C fcntl function rather than using SYS_FCNTL.
Change mksysinfo.sh to ensure that F_GETPIPE_SZ is always defined,
and check that in internal/poll.
Reviewed-on: https://go-review.googlesource.com/137256
From-SVN: r264572
Diffstat (limited to 'libgo/go/internal')
-rw-r--r-- | libgo/go/internal/bytealg/indexbyte_generic.go | 2 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_arm.go | 7 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_arm64.go | 2 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_mips.go | 7 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_mips64.go | 7 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_mips64le.go | 7 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_mipsle.go | 7 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_ppc64x.go | 2 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_s390x.go | 2 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_wasm.go | 7 | ||||
-rw-r--r-- | libgo/go/internal/cpu/cpu_x86.go | 2 | ||||
-rw-r--r-- | libgo/go/internal/poll/splice_linux.go | 9 |
12 files changed, 8 insertions, 53 deletions
diff --git a/libgo/go/internal/bytealg/indexbyte_generic.go b/libgo/go/internal/bytealg/indexbyte_generic.go index 890cd42..6e59fd1 100644 --- a/libgo/go/internal/bytealg/indexbyte_generic.go +++ b/libgo/go/internal/bytealg/indexbyte_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +ignore_for_gccgo +// +build ignore_for_gccgo // +build !386,!amd64,!amd64p32,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!mips64,!mips64le,!wasm package bytealg diff --git a/libgo/go/internal/cpu/cpu_arm.go b/libgo/go/internal/cpu/cpu_arm.go deleted file mode 100644 index 078a6c3..0000000 --- a/libgo/go/internal/cpu/cpu_arm.go +++ /dev/null @@ -1,7 +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 cpu - -const CacheLineSize = 32 diff --git a/libgo/go/internal/cpu/cpu_arm64.go b/libgo/go/internal/cpu/cpu_arm64.go index 009f2a2..c4d6b81 100644 --- a/libgo/go/internal/cpu/cpu_arm64.go +++ b/libgo/go/internal/cpu/cpu_arm64.go @@ -4,8 +4,6 @@ package cpu -const CacheLineSize = 64 - // arm64 doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. // These are initialized by archauxv in runtime/os_linux_arm64.go. // These should not be changed after they are initialized. diff --git a/libgo/go/internal/cpu/cpu_mips.go b/libgo/go/internal/cpu/cpu_mips.go deleted file mode 100644 index 078a6c3..0000000 --- a/libgo/go/internal/cpu/cpu_mips.go +++ /dev/null @@ -1,7 +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 cpu - -const CacheLineSize = 32 diff --git a/libgo/go/internal/cpu/cpu_mips64.go b/libgo/go/internal/cpu/cpu_mips64.go deleted file mode 100644 index 078a6c3..0000000 --- a/libgo/go/internal/cpu/cpu_mips64.go +++ /dev/null @@ -1,7 +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 cpu - -const CacheLineSize = 32 diff --git a/libgo/go/internal/cpu/cpu_mips64le.go b/libgo/go/internal/cpu/cpu_mips64le.go deleted file mode 100644 index 078a6c3..0000000 --- a/libgo/go/internal/cpu/cpu_mips64le.go +++ /dev/null @@ -1,7 +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 cpu - -const CacheLineSize = 32 diff --git a/libgo/go/internal/cpu/cpu_mipsle.go b/libgo/go/internal/cpu/cpu_mipsle.go deleted file mode 100644 index 078a6c3..0000000 --- a/libgo/go/internal/cpu/cpu_mipsle.go +++ /dev/null @@ -1,7 +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 cpu - -const CacheLineSize = 32 diff --git a/libgo/go/internal/cpu/cpu_ppc64x.go b/libgo/go/internal/cpu/cpu_ppc64x.go index d3f02ef..5c4bed7 100644 --- a/libgo/go/internal/cpu/cpu_ppc64x.go +++ b/libgo/go/internal/cpu/cpu_ppc64x.go @@ -6,8 +6,6 @@ package cpu -const CacheLineSize = 128 - // ppc64x doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. // These are initialized by archauxv in runtime/os_linux_ppc64x.go. // These should not be changed after they are initialized. diff --git a/libgo/go/internal/cpu/cpu_s390x.go b/libgo/go/internal/cpu/cpu_s390x.go index 9dedb4c..43fa4ad 100644 --- a/libgo/go/internal/cpu/cpu_s390x.go +++ b/libgo/go/internal/cpu/cpu_s390x.go @@ -4,8 +4,6 @@ package cpu -const CacheLineSize = 256 - // bitIsSet reports whether the bit at index is set. The bit index // is in big endian order, so bit index 0 is the leftmost bit. func bitIsSet(bits []uint64, index uint) bool { diff --git a/libgo/go/internal/cpu/cpu_wasm.go b/libgo/go/internal/cpu/cpu_wasm.go deleted file mode 100644 index 1107a7a..0000000 --- a/libgo/go/internal/cpu/cpu_wasm.go +++ /dev/null @@ -1,7 +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 cpu - -const CacheLineSize = 64 diff --git a/libgo/go/internal/cpu/cpu_x86.go b/libgo/go/internal/cpu/cpu_x86.go index 7d9d3aa..5f15965 100644 --- a/libgo/go/internal/cpu/cpu_x86.go +++ b/libgo/go/internal/cpu/cpu_x86.go @@ -6,8 +6,6 @@ package cpu -const CacheLineSize = 64 - // cpuid is implemented in cpu_x86.s. func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) diff --git a/libgo/go/internal/poll/splice_linux.go b/libgo/go/internal/poll/splice_linux.go index aa237e5..4265b42 100644 --- a/libgo/go/internal/poll/splice_linux.go +++ b/libgo/go/internal/poll/splice_linux.go @@ -162,10 +162,15 @@ func newTempPipe() (prfd, pwfd int, sc string, err error) { defer atomic.StorePointer(&disableSplice, unsafe.Pointer(p)) // F_GETPIPE_SZ was added in 2.6.35, which does not have the -EAGAIN bug. - if _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fds[0]), syscall.F_GETPIPE_SZ, 0); errno != 0 { + if syscall.F_GETPIPE_SZ == 0 { *p = true destroyTempPipe(fds[0], fds[1]) - return -1, -1, "fcntl", errno + return -1, -1, "fcntl", syscall.EINVAL + } + if _, errno := fcntl(uintptr(fds[0]), syscall.F_GETPIPE_SZ, 0); errno != 0 { + *p = true + destroyTempPipe(fds[0], fds[1]) + return -1, -1, "fcntl", syscall.Errno(errno) } } |