aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2025-08-06 17:50:14 +0200
committerTobias Klauser <tklauser@distanz.ch>2025-08-11 15:25:38 -0700
commitce3f3e2ae73dcc0c270bc73a59ea5e7be6cf6a8d (patch)
treed2150a07215ad3569c725b23b4dca3df54be524e /src/cmd/link/internal
parent3dbef65bf37f1b7ccd1f884761341a5a15456ffa (diff)
downloadgo-ce3f3e2ae73dcc0c270bc73a59ea5e7be6cf6a8d.tar.xz
cmd/link/internal/ld, internal/syscall/unix: use posix_fallocate on netbsd
The posix_fallocate system call is available since NetBSD 7.0, see https://man.netbsd.org/posix_fallocate.2 Re-use the syscall wrappers already in place for freebsd. Note that posix_fallocate on netbsd also returns the result in r1 rather than in errno: > If successful, posix_fallocate() returns zero. It returns an error on failure, without > setting errno. Source: https://man.netbsd.org/posix_fallocate.2#RETURN%20VALUES Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64 Change-Id: Iaa1f6a805d511645da7f1d2737235bfd42da3407 Reviewed-on: https://go-review.googlesource.com/c/go/+/480475 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/link/internal')
-rw-r--r--src/cmd/link/internal/ld/fallocate_test.go2
-rw-r--r--src/cmd/link/internal/ld/outbuf_bsd.go (renamed from src/cmd/link/internal/ld/outbuf_freebsd.go)2
-rw-r--r--src/cmd/link/internal/ld/outbuf_mmap.go2
-rw-r--r--src/cmd/link/internal/ld/outbuf_nofallocate.go2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/link/internal/ld/fallocate_test.go b/src/cmd/link/internal/ld/fallocate_test.go
index d95fec788a..163ffc26e8 100644
--- a/src/cmd/link/internal/ld/fallocate_test.go
+++ b/src/cmd/link/internal/ld/fallocate_test.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.
-//go:build darwin || (freebsd && go1.21) || linux
+//go:build darwin || (freebsd && go1.21) || linux || (netbsd && go1.25)
package ld
diff --git a/src/cmd/link/internal/ld/outbuf_freebsd.go b/src/cmd/link/internal/ld/outbuf_bsd.go
index 7e718c1408..5dce83fefd 100644
--- a/src/cmd/link/internal/ld/outbuf_freebsd.go
+++ b/src/cmd/link/internal/ld/outbuf_bsd.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.
-//go:build freebsd && go1.21
+//go:build (freebsd && go1.21) || (netbsd && go1.25)
package ld
diff --git a/src/cmd/link/internal/ld/outbuf_mmap.go b/src/cmd/link/internal/ld/outbuf_mmap.go
index b8b8dc5158..e92a06dcb2 100644
--- a/src/cmd/link/internal/ld/outbuf_mmap.go
+++ b/src/cmd/link/internal/ld/outbuf_mmap.go
@@ -28,7 +28,7 @@ func (out *OutBuf) Mmap(filesize uint64) (err error) {
// Some file systems do not support fallocate. We ignore that error as linking
// can still take place, but you might SIGBUS when you write to the mmapped
// area.
- if err != syscall.ENOTSUP && err != syscall.EPERM && err != errNoFallocate {
+ if err != syscall.ENOTSUP && err != syscall.EOPNOTSUPP && err != syscall.EPERM && err != errNoFallocate {
return err
}
}
diff --git a/src/cmd/link/internal/ld/outbuf_nofallocate.go b/src/cmd/link/internal/ld/outbuf_nofallocate.go
index 435be5e09f..9169379e23 100644
--- a/src/cmd/link/internal/ld/outbuf_nofallocate.go
+++ b/src/cmd/link/internal/ld/outbuf_nofallocate.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.
-//go:build !darwin && !(freebsd && go1.21) && !linux
+//go:build !darwin && !(freebsd && go1.21) && !linux && !(netbsd && go1.25)
package ld