From bf314645e665d82c65771fb0d5f58558bbe1ba87 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 26 Oct 2020 22:10:02 -0700
Subject: [PATCH] Define __NR_futex if it does not exist

__NR_futex is not defines by newer architectures e.g. arc, riscv32 as
they only have 64bit variant of time_t. Glibc defines SYS_futex interface based on
__NR_futex, since this is used in applications, such applications start
to fail to build for these newer architectures. This patch defines a
fallback to alias __NR_futex to __NR_futex_tim64 so SYS_futex keeps
working

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/corelib/thread/qfutex_p.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/corelib/thread/qfutex_p.h b/src/corelib/thread/qfutex_p.h
index f287b752d7..fa5307a604 100644
--- a/src/corelib/thread/qfutex_p.h
+++ b/src/corelib/thread/qfutex_p.h
@@ -76,6 +76,9 @@ QT_END_NAMESPACE
 #  include <unistd.h>
 #  include <asm/unistd.h>
 #  include <linux/futex.h>
+#  if !defined(__NR_futex) && defined(__NR_futex_time64)
+#    define __NR_futex __NR_futex_time64
+#  endif
 #  define QT_ALWAYS_USE_FUTEX
 
 // if not defined in linux/futex.h
-- 
2.29.1

