diff mbox series

[meta-oe] toybox: Fix build on 32bit arches with 64bit time_t defaults

Message ID 20220908151625.2594845-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] toybox: Fix build on 32bit arches with 64bit time_t defaults | expand

Commit Message

Khem Raj Sept. 8, 2022, 3:16 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...timer_settime_wrap-for-32bit-systems.patch | 37 +++++++++++++++++++
 meta-oe/recipes-core/toybox/toybox_0.8.8.bb   |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta-oe/recipes-core/toybox/toybox/0001-portability-Fix-timer_settime_wrap-for-32bit-systems.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-core/toybox/toybox/0001-portability-Fix-timer_settime_wrap-for-32bit-systems.patch b/meta-oe/recipes-core/toybox/toybox/0001-portability-Fix-timer_settime_wrap-for-32bit-systems.patch
new file mode 100644
index 0000000000..8976b3748b
--- /dev/null
+++ b/meta-oe/recipes-core/toybox/toybox/0001-portability-Fix-timer_settime_wrap-for-32bit-systems.patch
@@ -0,0 +1,37 @@ 
+From 7284c7ae0df9aa5a9c8aa0a81a018e17289fe2c4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 8 Sep 2022 07:22:26 -0700
+Subject: [PATCH] portability: Fix timer_settime_wrap for 32bit systems with
+ 64bit time_t
+
+glibc does not define SYS_timer_settime if the 32bit syscall is not
+available, new architectures like riscv32 has defaulted to 64bit time_t
+from get go and avoided wiring 32bit syscall, therefore alias it to
+64bit version here
+
+Upstream-Status: Submitted [https://github.com/landley/toybox/pull/373]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/portability.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/lib/portability.c b/lib/portability.c
+index d955d081..4baa9367 100644
+--- a/lib/portability.c
++++ b/lib/portability.c
+@@ -711,6 +711,12 @@ int timer_create_wrap(clockid_t c, struct sigevent *se, timer_t *t)
+   return 0;
+ }
+ 
++#if !defined(SYS_timer_settime) && defined(SYS_timer_settime64)
++// glibc does not define defines SYS_timer_settime on 32-bit systems
++// with 64-bit time_t defaults e.g. riscv32
++#define SYS_timer_settime SYS_timer_settime64
++#endif
++
+ int timer_settime_wrap(timer_t t, int flags, struct itimerspec *val,
+   struct itimerspec *old)
+ {
+-- 
+2.37.3
+
diff --git a/meta-oe/recipes-core/toybox/toybox_0.8.8.bb b/meta-oe/recipes-core/toybox/toybox_0.8.8.bb
index 89411cecc9..6836b14682 100644
--- a/meta-oe/recipes-core/toybox/toybox_0.8.8.bb
+++ b/meta-oe/recipes-core/toybox/toybox_0.8.8.bb
@@ -8,6 +8,7 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=78659a599b9325da368f2f1eb88f19c7"
 inherit cml1 update-alternatives
 
 SRC_URI = "http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz \
+           file://0001-portability-Fix-timer_settime_wrap-for-32bit-systems.patch \
            "
 SRC_URI[sha256sum] = "dafd41978d40f02a61cf1be99a2b4a25812bbfb9c3157e679ee7611202d6ac58"