[PATCH 4/5] tools/nolibc: introduce __NOLIBC_BITS_PER_SYSCALL_ARG
From: Thomas Weißschuh
Date: Sun Sep 27 2026 - 04:50:04 EST
ILP32 architectures, like x32 and n32, support 64-bit system call
arguments, although they are nominally 32-bit architectures.
Add a new define which provides the size of system call arguments
so generic libc code can use the best system call for those.
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
tools/include/nolibc/arch-mips.h | 1 +
tools/include/nolibc/arch-x86.h | 2 ++
tools/include/nolibc/arch.h | 5 +++++
3 files changed, 8 insertions(+)
diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h
index 21b9959a08e2..c0da0cc309ce 100644
--- a/tools/include/nolibc/arch-mips.h
+++ b/tools/include/nolibc/arch-mips.h
@@ -72,6 +72,7 @@
#define _NOLIBC_SYSCALL_STACK_UNRESERVE
#define _NOLIBC_SYSCALL_REG register long long
+#define __NOLIBC_BITS_PER_SYSCALL_ARG 64
#endif /* _ABIO32 */
diff --git a/tools/include/nolibc/arch-x86.h b/tools/include/nolibc/arch-x86.h
index 577e9b682eb3..0638f9316749 100644
--- a/tools/include/nolibc/arch-x86.h
+++ b/tools/include/nolibc/arch-x86.h
@@ -386,5 +386,7 @@ __asm__ (
".popsection\n"
);
+#define __NOLIBC_BITS_PER_SYSCALL_ARG 64
+
#endif /* !defined(__x86_64__) */
#endif /* _NOLIBC_ARCH_X86_H */
diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h
index 24e0ec4fb2db..79ed5900f2a7 100644
--- a/tools/include/nolibc/arch.h
+++ b/tools/include/nolibc/arch.h
@@ -40,4 +40,9 @@
#error Unsupported Architecture
#endif
+
+#ifndef __NOLIBC_BITS_PER_SYSCALL_ARG
+#define __NOLIBC_BITS_PER_SYSCALL_ARG __BITS_PER_LONG
+#endif
+
#endif /* _NOLIBC_ARCH_H */
--
2.55.0