glibc does not define SYS_futex for 32bit architectures using 64bit
time_t e.g. riscv32, therefore perf fails to compile as it does not find
SYS_futex in C library headers, define it to SYS_futex_time64 when it
exists

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.k...@gmail.com>
---
 tools/perf/bench/futex.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h
index 31b53cc7d5bc..33f3f3230ae1 100644
--- a/tools/perf/bench/futex.h
+++ b/tools/perf/bench/futex.h
@@ -13,6 +13,19 @@
 #include <sys/types.h>
 #include <linux/futex.h>
 
+/**
+ * SYS_futex is expected from system C library,
+ * in glibc (/usr/include/bits/syscall.h defines it in terms of of NR_futex)
+ * some newer 32bit architectures e.g. RISCV32 is using 64bit time_t from
+ * get go unlike other 32bit architectures in glibc, therefore it wont have
+ * NR_futex defined but just NR_futex_time64 this aliases it to NR_futex
+ * so that SYS_futex is then defined for rv32
+*/
+
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+#define SYS_futex SYS_futex_time64
+#endif
+
 /**
  * futex() - SYS_futex syscall wrapper
  * @uaddr:     address of first futex
-- 
2.29.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9162): 
https://lists.yoctoproject.org/g/linux-yocto/message/9162
Mute This Topic: https://lists.yoctoproject.org/mt/78299646/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to