[libcxx-commits] [PATCH] D85095: Fix libcxx build on 32bit architectures with 64bit time_t defaults e.g. riscv32
Khem Raj via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 16 13:36:51 PST 2020
raj.khem updated this revision to Diff 305585.
raj.khem added a comment.
it should have been after including syscall.h
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85095/new/
https://reviews.llvm.org/D85095
Files:
libcxx/src/atomic.cpp
Index: libcxx/src/atomic.cpp
===================================================================
--- libcxx/src/atomic.cpp
+++ libcxx/src/atomic.cpp
@@ -19,6 +19,16 @@
#include <linux/futex.h>
#include <sys/syscall.h>
+// libc++ uses SYS_futex, which it expects from system C library.
+// in glibc (/usr/include/bits/syscall.h defines it in terms of of NR_futex)
+// rv32 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
+
#else // <- Add other operating systems here
// Baseline needs no new headers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85095.305585.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201116/76e97406/attachment-0001.bin>
More information about the libcxx-commits
mailing list