[PATCH 3/5] tools/nolibc: move __NOLIBC_LLARGPART() to compiler.h
From: Thomas Weißschuh
Date: Sun Sep 27 2026 - 04:49:51 EST
pread() and pwrite() support will require the usage of the macro from
the arch-*.h headers. sys.h can not be used from those.
Move the macro to a more generic header.
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
tools/include/nolibc/compiler.h | 9 +++++++++
tools/include/nolibc/sys.h | 10 ----------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h
index f2d7a81d0d7c..375c45ce81c8 100644
--- a/tools/include/nolibc/compiler.h
+++ b/tools/include/nolibc/compiler.h
@@ -90,4 +90,13 @@
# define __nolibc_no_sanitize_undefined
#endif
+/*
+ * Helper for 32-bit machines where a 64-bit syscall arg needs to be split into
+ * two 32-bit parts while making sure the order of the low/high parts are correct
+ * for the endianness:
+ * __NOLIBC_LLARGPART(x, 0), __NOLIBC_LLARGPART(x, 1)
+ */
+#define __NOLIBC_LLARGPART(_arg, _part) \
+ (((union { long long ll; long l[2]; }) { .ll = _arg }).l[_part])
+
#endif /* _NOLIBC_COMPILER_H */
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index 548f94d96ed2..7f06d27da612 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -71,16 +71,6 @@ static __inline__ int __nolibc_enosys(const char *syscall, ...)
#endif
-/*
- * Helper for 32-bit machines where a 64-bit syscall arg needs to be split into
- * two 32-bit parts while making sure the order of the low/high parts are correct
- * for the endianness:
- * __NOLIBC_LLARGPART(x, 0), __NOLIBC_LLARGPART(x, 1)
- */
-#define __NOLIBC_LLARGPART(_arg, _part) \
- (((union { long long ll; long l[2]; }) { .ll = _arg }).l[_part])
-
-
/* Functions in this file only describe syscalls. They're declared static so
* that the compiler usually decides to inline them while still being allowed
* to pass a pointer to one of their instances. Each syscall exists in two
--
2.55.0