summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Fontaine <fontaine.fabrice@gmail.com>2021-08-27 16:28:32 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-09-02 18:27:41 +0200
commit0217200c88fef4a7045990db6d3498c606506ecc (patch)
tree834f5a5d4a41b0da54ffd76ded52c0e176e65d66
parent87b5d77aeaf9aaa9530d546f728cc8cffc9a0523 (diff)
Fix build on riscv32
riscv32 fails to build because __NR_futex is not defined on this architecture: In file included from thread/qmutex_linux.cpp:45, from thread/qmutex.cpp:804: thread/qfutex_p.h: In function 'int QtLinuxFutex::_q_futex(int*, int, int, quintptr, int*, int)': thread/qfutex_p.h:116:30: error: '__NR_futex' was not declared in this scope; did you mean '_q_futex'? 116 | int result = syscall(__NR_futex, addr, op | FUTEX_PRIVATE_FLAG, val, val2, addr2, val3); | ^~~~~~~~~~ | _q_futex Fixes: QTBUG-96067 Change-Id: Ib6a9bcc496f37e69ac39362cb0a021fccaf311f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 035dc537bee26e3b63a211b2835d8560439e161f)
-rw-r--r--src/corelib/thread/qfutex_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/thread/qfutex_p.h b/src/corelib/thread/qfutex_p.h
index e4bfeda5f8..7228c0d625 100644
--- a/src/corelib/thread/qfutex_p.h
+++ b/src/corelib/thread/qfutex_p.h
@@ -81,6 +81,11 @@ QT_END_NAMESPACE
// if not defined in linux/futex.h
# define FUTEX_PRIVATE_FLAG 128 // added in v2.6.22
+// RISC-V does not supply __NR_futex
+# ifndef __NR_futex
+# define __NR_futex __NR_futex_time64
+# endif
+
# if (__has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)) && __has_include(<sanitizer/tsan_interface.h>)
# include <sanitizer/tsan_interface.h>
inline void _q_tsan_acquire(void *addr, void *addr2)