This is not among the normal patches as these changes are musl specific and
there is no way to easily conditionalize it in source for some of the changes.

Source: https://gitlab.alpinelinux.org/alpine/alpine-gcc-patches/-/tree/alpine/13.1?ref_type=heads

From 4bfcb35bc43d3e3b7510620362d7c28d9e4c17ca Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 10 Jul 2023 23:23:29 +0000
Subject: [PATCH 34/35] libgo: fix lfs64 use

---
 .../go/internal/syscall/unix/at_largefile.go  |  2 +-
 libgo/go/os/dir_largefile.go                  |  2 +-
 libgo/go/syscall/libcall_glibc.go             |  2 +-
 libgo/go/syscall/libcall_linux.go             |  4 +--
 libgo/go/syscall/libcall_posix_largefile.go   | 26 +++++++++----------
 libgo/runtime/go-varargs.c                    |  2 +-
 libgo/sysinfo.c                               |  9 +++----
 7 files changed, 22 insertions(+), 25 deletions(-)

--- a/libgo/go/internal/syscall/unix/at_largefile.go
+++ b/libgo/go/internal/syscall/unix/at_largefile.go
@@ -10,5 +10,5 @@ import (
 	"syscall"
 )
 
-//extern fstatat64
+//extern fstatat
 func fstatat(int32, *byte, *syscall.Stat_t, int32) int32
--- a/libgo/go/os/dir_largefile.go
+++ b/libgo/go/os/dir_largefile.go
@@ -11,5 +11,5 @@ package os
 
 import "syscall"
 
-//extern readdir64
+//extern readdir
 func libc_readdir(*syscall.DIR) *syscall.Dirent
--- a/libgo/go/syscall/libcall_glibc.go
+++ b/libgo/go/syscall/libcall_glibc.go
@@ -114,7 +114,7 @@ func Pipe2(p []int, flags int) (err erro
 }
 
 //sys	sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error)
-//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
+//sendfile(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
 
 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 	if race.Enabled {
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -158,7 +158,7 @@ func Reboot(cmd int) (err error) {
 //adjtimex(buf *Timex) _C_int
 
 //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
-//fstatfs64(fd _C_int, buf *Statfs_t) _C_int
+//fstatfs(fd _C_int, buf *Statfs_t) _C_int
 
 func Gettid() (tid int) {
 	r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0)
@@ -245,7 +245,7 @@ func Splice(rfd int, roff *int64, wfd in
 }
 
 //sys	Statfs(path string, buf *Statfs_t) (err error)
-//statfs64(path *byte, buf *Statfs_t) _C_int
+//statfs(path *byte, buf *Statfs_t) _C_int
 
 //sysnb	Sysinfo(info *Sysinfo_t) (err error)
 //sysinfo(info *Sysinfo_t) _C_int
--- a/libgo/go/syscall/libcall_posix_largefile.go
+++ b/libgo/go/syscall/libcall_posix_largefile.go
@@ -10,40 +10,40 @@
 package syscall
 
 //sys	Creat(path string, mode uint32) (fd int, err error)
-//creat64(path *byte, mode Mode_t) _C_int
+//creat(path *byte, mode Mode_t) _C_int
 
 //sys	Fstat(fd int, stat *Stat_t) (err error)
-//fstat64(fd _C_int, stat *Stat_t) _C_int
+//fstat(fd _C_int, stat *Stat_t) _C_int
 
 //sys	Ftruncate(fd int, length int64) (err error)
-//ftruncate64(fd _C_int, length Offset_t) _C_int
+//ftruncate(fd _C_int, length Offset_t) _C_int
 
 //sysnb	Getrlimit(resource int, rlim *Rlimit) (err error)
-//getrlimit64(resource _C_int, rlim *Rlimit) _C_int
+//getrlimit(resource _C_int, rlim *Rlimit) _C_int
 
 //sys	Lstat(path string, stat *Stat_t) (err error)
-//lstat64(path *byte, stat *Stat_t) _C_int
+//lstat(path *byte, stat *Stat_t) _C_int
 
 //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
+//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
 
 //sys	Open(path string, mode int, perm uint32) (fd int, err error)
-//__go_open64(path *byte, mode _C_int, perm Mode_t) _C_int
+//__go_open(path *byte, mode _C_int, perm Mode_t) _C_int
 
 //sys	Pread(fd int, p []byte, offset int64) (n int, err error)
-//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
 
 //sys	Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//pwrite64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pwrite(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
 
 //sys	Seek(fd int, offset int64, whence int) (off int64, err error)
-//lseek64(fd _C_int, offset Offset_t, whence _C_int) Offset_t
+//lseek(fd _C_int, offset Offset_t, whence _C_int) Offset_t
 
 //sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
-//setrlimit64(resource int, rlim *Rlimit) _C_int
+//setrlimit(resource int, rlim *Rlimit) _C_int
 
 //sys	Stat(path string, stat *Stat_t) (err error)
-//stat64(path *byte, stat *Stat_t) _C_int
+//stat(path *byte, stat *Stat_t) _C_int
 
 //sys	Truncate(path string, length int64) (err error)
-//truncate64(path *byte, length Offset_t) _C_int
+//truncate(path *byte, length Offset_t) _C_int
--- a/libgo/runtime/go-varargs.c
+++ b/libgo/runtime/go-varargs.c
@@ -84,7 +84,7 @@ __go_ioctl_ptr (int d, int request, void
 int
 __go_open64 (char *path, int mode, mode_t perm)
 {
-  return open64 (path, mode, perm);
+  return open (path, mode, perm);
 }
 
 #endif
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -366,7 +366,7 @@ typedef loff_t libgo_loff_t_type;
 #endif
 
 #if defined(HAVE_OFF64_T)
-typedef off64_t libgo_off_t_type;
+typedef off_t libgo_off_t_type;
 #else
 typedef off_t libgo_off_t_type;
 #endif
@@ -398,13 +398,11 @@ typedef off_t libgo_off_t_type;
 
 // From dirent.h
 SREF(dirent);
-SREF(dirent64);
 OTREF(DIR);
 EREF(DT_UNKNOWN);
 
 // From fcntl.h
 SREF(flock);
-SREF(flock64);
 
 // From ffi headers
 SREF(_ffi_type);
@@ -485,11 +483,10 @@ EREF(SS_ONSTACK);
 EREF(SEGV_MAPERR);
 
 // From stat.h
-SREF(stat64);
+SREF(stat);
 
 // From statfs.h
 SREF(statfs);
-SREF(statfs64);
 
 // From sysinfo.h
 SREF(sysinfo);
@@ -519,7 +516,7 @@ EREF(PTRACE_PEEKTEXT);
 
 // From sys/resource.h
 SREF(rusage);
-SREF(rlimit64);
+SREF(rlimit);
 EREF(RLIMIT_NOFILE);
 EREF(PRIO_USER);
 EREF(RUSAGE_SELF);
