[libcxx-commits] [PATCH] D85095: Fix libcxx build on riscv32

Khem Raj via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 14 14:56:33 PST 2020


raj.khem updated this revision to Diff 305332.
raj.khem added a comment.

Add comments in source


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
@@ -15,6 +15,16 @@
 
 #ifdef __linux__
 
+// 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
+
 #include <unistd.h>
 #include <linux/futex.h>
 #include <sys/syscall.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85095.305332.patch
Type: text/x-patch
Size: 741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201114/6160f31f/attachment.bin>


More information about the libcxx-commits mailing list