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.
Signed-off-by: Nadav Tasher tashernadav@gmail.com --- include/features.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/features.h b/include/features.h index 1a4efb9db..0b09d71a2 100644 --- a/include/features.h +++ b/include/features.h @@ -449,6 +449,12 @@ # 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
Hi Nadav, Nadav Tasher wrote,
Hi Waldermar,
Have you had time to concider my new approach?
Yes. I pushed the changes today. They are part of the new 1.0.51 release.
best regards Waldemar
Nadav
On Tue, Jan 07, 2025 at 01:06:02AM +0200, Nadav Tasher wrote:
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 tashernadav@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 tashernadav@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 tashernadav@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 tashernadav@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-leave@uclibc-ng.org
Friendly nudge :)
On Sun, Dec 22, 2024 at 10:11:57PM +0200, Nadav Tasher wrote:
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.
Signed-off-by: Nadav Tasher tashernadav@gmail.com
include/features.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/features.h b/include/features.h index 1a4efb9db..0b09d71a2 100644 --- a/include/features.h +++ b/include/features.h @@ -449,6 +449,12 @@ # 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
Hi Nadav,
I applied your patch and pushed it. But I am getting now following warnings from Busybox compile: /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/bin/aarch64-openadk-linux-uclibc-gcc -Wp,-MD,shell/.shell_common.o.d -DNDEBUG -std=gnu99 -Iinclude -Ilibbb -include include/autoconf.h -D_GNU_ SOURCE -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBB_VER='"1.36.1"' -fwrapv -fno-ident -mcpu=cortex-a53 -Os -pipe -fomit-frame-pointer -Wall -Wshadow -Wwrite-strings -Wundef -Wstr ict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-style-definition -finline-limit=0 - fno-builtin-strlen -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-u nwind-tables -fno-asynchronous-unwind-tables -fno-builtin-printf -Os -DKBUILD_BASENAME='"shell_common"' -DKBUILD_MODNAME='"shell_common"' -c -o shell/shell_common.o shell/shell_common.c In file included from include/libbb.h:13, from util-linux/wall.c:29: include/platform.h:306: warning: "KERNEL_VERSION" redefined 306 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | In file included from /home/wbx/openadk/target_qemu-aarch64_uclibc-ng_cortex_a53/usr/include/features.h:434, from /home/wbx/openadk/target_qemu-aarch64_uclibc-ng_cortex_a53/usr/include/limits.h:26, from /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/lib/gcc/aarch64-openadk-linux-uclibc/13.3.0/include/limits.h:205, from /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/lib/gcc/aarch64-openadk-linux-uclibc/13.3.0/include/syslimits.h:7, from /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/lib/gcc/aarch64-openadk-linux-uclibc/13.3.0/include/limits.h:34, from include/platform.h:157: /home/wbx/openadk/target_qemu-aarch64_uclibc-ng_cortex_a53/usr/include/linux/version.h:2: note: this is the location of the previous definition 2 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c))) |
Any idea how to avoid this?
best regards Waldemar
Nadav Tasher wrote,
Friendly nudge :)
On Sun, Dec 22, 2024 at 10:11:57PM +0200, Nadav Tasher wrote:
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.
Signed-off-by: Nadav Tasher tashernadav@gmail.com
include/features.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/features.h b/include/features.h index 1a4efb9db..0b09d71a2 100644 --- a/include/features.h +++ b/include/features.h @@ -449,6 +449,12 @@ # 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
devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org
That's probably caused by the inclusion of linux/version.h. I will try to find an alternative approach.
On Mon, Jan 06, 2025 at 02:33:25PM +0100, Waldemar Brodkorb wrote:
Hi Nadav,
I applied your patch and pushed it. But I am getting now following warnings from Busybox compile: /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/bin/aarch64-openadk-linux-uclibc-gcc -Wp,-MD,shell/.shell_common.o.d -DNDEBUG -std=gnu99 -Iinclude -Ilibbb -include include/autoconf.h -D_GNU_ SOURCE -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DBB_VER='"1.36.1"' -fwrapv -fno-ident -mcpu=cortex-a53 -Os -pipe -fomit-frame-pointer -Wall -Wshadow -Wwrite-strings -Wundef -Wstr ict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-style-definition -finline-limit=0 - fno-builtin-strlen -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-u nwind-tables -fno-asynchronous-unwind-tables -fno-builtin-printf -Os -DKBUILD_BASENAME='"shell_common"' -DKBUILD_MODNAME='"shell_common"' -c -o shell/shell_common.o shell/shell_common.c In file included from include/libbb.h:13, from util-linux/wall.c:29: include/platform.h:306: warning: "KERNEL_VERSION" redefined 306 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | In file included from /home/wbx/openadk/target_qemu-aarch64_uclibc-ng_cortex_a53/usr/include/features.h:434, from /home/wbx/openadk/target_qemu-aarch64_uclibc-ng_cortex_a53/usr/include/limits.h:26, from /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/lib/gcc/aarch64-openadk-linux-uclibc/13.3.0/include/limits.h:205, from /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/lib/gcc/aarch64-openadk-linux-uclibc/13.3.0/include/syslimits.h:7, from /home/wbx/openadk/toolchain_qemu-aarch64_uclibc-ng_cortex_a53/usr/lib/gcc/aarch64-openadk-linux-uclibc/13.3.0/include/limits.h:34, from include/platform.h:157: /home/wbx/openadk/target_qemu-aarch64_uclibc-ng_cortex_a53/usr/include/linux/version.h:2: note: this is the location of the previous definition 2 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c))) |
Any idea how to avoid this?
best regards Waldemar
Nadav Tasher wrote,
Friendly nudge :)
On Sun, Dec 22, 2024 at 10:11:57PM +0200, Nadav Tasher wrote:
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.
Signed-off-by: Nadav Tasher tashernadav@gmail.com
include/features.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/features.h b/include/features.h index 1a4efb9db..0b09d71a2 100644 --- a/include/features.h +++ b/include/features.h @@ -449,6 +449,12 @@ # 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
devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org
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.
Hi Waldermar,
Have you had time to concider my new approach?
Nadav
On Tue, Jan 07, 2025 at 01:06:02AM +0200, Nadav Tasher wrote:
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 tashernadav@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 tashernadav@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 tashernadav@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 tashernadav@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