missing recv() support for aarch64

[email protected] Fri, 11 Jan 2019 10:24:18 +0100 (CET)
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi,

while cross compiling embutils (tar) for aarch64 I've got a linker error
because recv is undefined:

...
/opt/diet/bin-x86_64/diet aarch64-v8a-linux-gnu-gcc -o bin-arm64/tar bin-arm64/tar.o -Wl,-z,noseparate-code
/opt/OSELAS.Toolchain-2018.12.0/aarch64-v8a-linux-gnu/gcc-8.2.1-glibc-2.28-binutils-2.31.1-kernel-4.19.8-sanitized/bin/../lib/gcc/aarch64-v8a-linux-gnu/8.2.1/../../../../aarch64-v8a-linux-gnu/bin/ld: bin-arm64/tar.o: in function `mmapsendfile':
tar.c:(.text+0x13fc): warning: sendfile is not portable
/opt/OSELAS.Toolchain-2018.12.0/aarch64-v8a-linux-gnu/gcc-8.2.1-glibc-2.28-binutils-2.31.1-kernel-4.19.8-sanitized/bin/../lib/gcc/aarch64-v8a-linux-gnu/8.2.1/../../../../aarch64-v8a-linux-gnu/bin/ld: bin-arm64/tar.o: in function `main':
tar.c:(.text.startup+0x1814): undefined reference to `recv'
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:79: bin-arm64/tar] Error 1

On arm and x86_64 embutils builds OK.

I've tried to compare the dietlibc code on the three archs: if I got it right on arm
there is directly a recv syscall in the linux kernel, defined in 'arm/syscalls.h',
on x86_64 recv() is implemented in terms of recvfrom() in 'x86_64/recv.c'.

grepping the kernel sources I found a recv define also for aarch64:
linux-4.20.1/arch/arm64/include/asm/unistd32.h:

...
#define __NR_recv 291
__SYSCALL(__NR_recv, compat_sys_recv)
...

What would be the proper recv() definition for aarch64 ?

giorgio