Waldemar,

I have come up with a different approach to solving the original issue.

Instead of having this check in the `features.h` header file (which is included 
by other projects),
adding this check in a more internal header file (which is not included by 
other projects) results in
the same outcome, which is a human-readable error regarding kernel version.

I have attached two new patches to revert the previous changes and reintroduce 
them in the `time64_helpers.h`
header file.
>From 54cae8e860654200ce38a707984bfe98a5ee182b Mon Sep 17 00:00:00 2001
From: Nadav Tasher <tasherna...@gmail.com>
Date: Tue, 7 Jan 2025 00:46:36 +0200
Subject: [PATCH 1/2] Revert "features.h: error out when attempting to compile
 with TIME64 for 32bit targets on Linux versions prior to 5.1.0"

This reverts previous changes made to features.h which caused redefinitions when including `features.h`.

The reverted functionality will be reintroduced in a future commit.

Signed-off-by: Nadav Tasher <tasherna...@gmail.com>
---
 include/features.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/features.h b/include/features.h
index 0b09d71a2..1a4efb9db 100644
--- a/include/features.h
+++ b/include/features.h
@@ -449,12 +449,6 @@
 # include <libc-internal.h>
 #endif
 
-#include <linux/version.h>
-
-#if defined(__UCLIBC_USE_TIME64__) && __TARGET_ARCH_BITS__ == 32 && LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
-#error 64bit time on 32bit targets is not supported on Linux < 5.1.0
-#endif
-
 #if defined(__UCLIBC_USE_TIME64__) || __TARGET_ARCH_BITS__ == 64
 #define __USE_TIME_BITS64 1
 #endif
-- 
2.34.1

>From 0a617666dc18ebe7063ff625907341479863c443 Mon Sep 17 00:00:00 2001
From: Nadav Tasher <tasherna...@gmail.com>
Date: Tue, 7 Jan 2025 00:51:16 +0200
Subject: [PATCH 2/2] time64_helpers.h: error out when attempting to compile
 with TIME64 for 32bit targets on Linux versions prior to 5.1.0

Using 64bit time on 32bit targets was only introduced in Linux 5.1.0.
On versions prior to that, compiling uClibc-ng produces incorrect headers
that cause the `clock_nanosleep` syscall to receive incorrect arguments.

This change was previously introduced in `features.h`, but was reverted due to inclusion errors when compiling other
projects.

Signed-off-by: Nadav Tasher <tasherna...@gmail.com>
---
 include/internal/time64_helpers.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/internal/time64_helpers.h b/include/internal/time64_helpers.h
index 2284aacd9..e2ed0f3bb 100644
--- a/include/internal/time64_helpers.h
+++ b/include/internal/time64_helpers.h
@@ -1,10 +1,15 @@
 #ifndef _TIME64_HELPERS_H
 #define _TIME64_HELPERS_H
 
+#include <linux/version.h>
 #include <bits/types.h>
 #include <time.h>
 #include <stddef.h>
 
+#if defined(__UCLIBC_USE_TIME64__) && __TARGET_ARCH_BITS__ == 32 && LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
+#error 64bit time on 32bit targets is not supported on Linux < 5.1.0
+#endif
+
 struct __ts64_struct {
    __S64_TYPE tv_sec;
    __S64_TYPE tv_nsec;
-- 
2.34.1

_______________________________________________
devel mailing list -- devel@uclibc-ng.org
To unsubscribe send an email to devel-le...@uclibc-ng.org

Reply via email to