I am trying to address this issue 
https://github.com/golang/go/issues/45886, which involves new system calls.

I added the corresponding //sys comments in syscall_linux_*.go, but I am 
unable to generate them; some errors keep occurring. I'm wondering if it 
might be an issue with the kernel of the Linux distribution I'm using?

This is how I execute it.

export GOOS=linux
export GOARCH=arm64
./mkall.sh

Of course, even if I haven't made any changes to any files, running 
./mkall.sh still results in some strange issues.


I have made the following attempts.

I did not make any adjustments and only used the code from the Go master 
branch. When executing ./mkall.sh, the following error occurs.

./mkall.sh
# syscall
./zsyscall_linux_arm64.go:1117:22: undefined: SYS_FSTAT
./zsyscall_linux_arm64.go:1132:23: undefined: SYS_FSTATAT
./zsyscall_linux_arm64.go:1248:23: undefined: SYS_RENAMEAT
./zsyscall_linux_arm64.go:1336:23: undefined: SYS_SYNC_FILE_RANGE2


uname -a
Linux lima-default 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:55:34 
UTC 2025 aarch64 aarch64 aarch64 GNU/Linux

// /usr/include/asm-generic/unistd.h
....
#define __NR_readlinkat 78
__SYSCALL(__NR_readlinkat, sys_readlinkat)
#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
#define __NR3264_fstatat 79
__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
#define __NR3264_fstat 80
__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
#endif
....

The reason is that __ARCH_WANT_NEW_STAT or __ARCH_WANT_STAT64 were not 
defined. In mksysnum_linux.pl, gcc -E -dD was used to export all 
definitions, but __NR3264_fstatat and __NR3264_fstat were not included.

Finally, I found a similar file at 
/usr/include/aarch64-linux-gnu/asm/unistd.h. Running gcc -E -dD 
/usr/include/aarch64-linux-gnu/asm/unistd.h correctly exports 
__NR3264_fstatat and __NR3264_fstat.

However, SYS_SYNC_FILE_RANGE2 is not present.

So, could it be that there is an issue with the distribution I am using? I 
would like to know how others handle generating the corresponding files 
when developing system calls. I couldn't find any related documentation in 
src/syscall. <https://github.com/golang/go/tree/master/src/syscall>

在2025年8月27日星期三 UTC+8 14:26:34<Kurtis Rader> 写道:

> Insufficient information. Can you provide a link to your proposed change 
> as well as an explanation for the change? Is there an open issue that 
> provides background information for what you are attempting?
>
> On Tue, Aug 26, 2025 at 11:09 PM [email protected] <[email protected]> 
> wrote:
>
>> Hello,
>>
>> I am attempting to generate new system calls for Golang's syscall package. 
>> While running ./mkall.sh on Ubuntu 20.04.6 LTS AARCH64, I consistently 
>> encounter the following error:
>> plaintext
>> ./zsyscall_linux_arm64.go:1336:23: undefined: SYS_SYNC_FILE_RANGE2 go 
>> tool cgo: signal: broken pipe
>>
>> This issue suggests that SYS_SYNC_FILE_RANGE2 is not defined in the 
>> context of the build. Could someone advise which Linux distribution (and 
>> version) is recommended for successfully generating system calls for 
>> AARCH64?
>>
>> Thank you in advance for your guidance!
>>
>>
>>
>> Linux lima-default 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:55:34 
>> UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
>>
>>
>> AR='ar'
>> CC='gcc'
>> CGO_CFLAGS='-O2 -g'
>> CGO_CPPFLAGS=''
>> CGO_CXXFLAGS='-O2 -g'
>> CGO_ENABLED='1'
>> CGO_FFLAGS='-O2 -g'
>> CGO_LDFLAGS='-O2 -g'
>> CXX='g++'
>> GCCGO='gccgo'
>> GO111MODULE=''
>> GOARCH='arm64'
>> GOARM64='v8.0'
>> GOAUTH='netrc'
>> GOBIN=''
>> GOCACHE='/home/dingli.linux/.cache/go-build'
>> GOCACHEPROG=''
>> GODEBUG=''
>> GOENV='/home/dingli.linux/.config/go/env'
>> GOEXE=''
>> GOEXPERIMENT=''
>> GOFIPS140='off'
>> GOFLAGS=''
>> GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 
>> -ffile-prefix-map=/tmp/go-build1072417917=/tmp/go-build 
>> -gno-record-gcc-switches'
>> GOHOSTARCH='arm64'
>> GOHOSTOS='linux'
>> GOINSECURE=''
>> GOMOD='/home/dingli.linux/work/go/src/go.mod'
>> GOMODCACHE='/home/dingli.linux/go/pkg/mod'
>> GONOPROXY=''
>> GONOSUMDB=''
>> GOOS='linux'
>> GOPATH='/home/dingli.linux/go'
>> GOPRIVATE=''
>> GOPROXY='https://proxy.golang.org,direct'
>> GOROOT='/home/dingli.linux/work/go'
>> GOSUMDB='sum.golang.org'
>> GOTELEMETRY='local'
>> GOTELEMETRYDIR='/home/dingli.linux/.config/go/telemetry'
>> GOTMPDIR=''
>> GOTOOLCHAIN='auto'
>> GOTOOLDIR='/home/dingli.linux/work/go/pkg/tool/linux_arm64'
>> GOVCS=''
>> GOVERSION='go1.26-devel_77f911e31c Fri Aug 15 18:10:28 2025 -0700'
>> GOWORK=''
>> PKG_CONFIG='pkg-config'
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion visit 
>> https://groups.google.com/d/msgid/golang-nuts/4bdaf596-06b2-431f-b7aa-9f6c18ce97d0n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/4bdaf596-06b2-431f-b7aa-9f6c18ce97d0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/b2c2a054-6246-4f85-abf2-1c1830d11837n%40googlegroups.com.

Reply via email to