[libc++] Fix libcxx build on 32bit architectures with 64bit time_t defaults e.g. riscv32
Patch by Khem Raj.
Differential Revision: https://reviews.llvm.org/D85095
GitOrigin-RevId: 85b9c5ccc172a1e61c7ecaaec4752587cb6f1e26
diff --git a/src/atomic.cpp b/src/atomic.cpp
index 6b73ed7..9ae1fb5 100644
--- a/src/atomic.cpp
+++ b/src/atomic.cpp
@@ -19,6 +19,12 @@
#include <linux/futex.h>
#include <sys/syscall.h>
+// libc++ uses SYS_futex as a universal syscall name. However, on 32 bit architectures
+// with a 64 bit time_t, we need to specify SYS_futex_time64.
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+# define SYS_futex SYS_futex_time64
+#endif
+
#else // <- Add other operating systems here
// Baseline needs no new headers