summaryrefslogtreecommitdiff
path: root/absl/base/internal/direct_mmap.h
diff options
context:
space:
mode:
authorGravatar Khem Raj <raj.khem@gmail.com>2020-05-18 10:23:50 -0700
committerGravatar GitHub <noreply@github.com>2020-05-18 13:23:50 -0400
commit3f347c46272886a099852a4cd303ecf37a054de8 (patch)
tree5f95c9cc76267e5ae42890e72b990fb20a7b4368 /absl/base/internal/direct_mmap.h
parent62cf6a70414e15b356ec4f712ca8758133674f28 (diff)
Fix build on riscv32 (#675)
Diffstat (limited to 'absl/base/internal/direct_mmap.h')
-rw-r--r--absl/base/internal/direct_mmap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h
index 5618867b..16accf09 100644
--- a/absl/base/internal/direct_mmap.h
+++ b/absl/base/internal/direct_mmap.h
@@ -61,6 +61,10 @@ extern "C" void* __mmap2(void*, size_t, int, int, int, size_t);
#endif
#endif // __BIONIC__
+#if defined(__NR_mmap2) && !defined(SYS_mmap2)
+#define SYS_mmap2 __NR_mmap2
+#endif
+
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
@@ -72,6 +76,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
#if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
(defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
(defined(__PPC__) && !defined(__PPC64__)) || \
+ (defined(__riscv) && __riscv_xlen == 32) || \
(defined(__s390__) && !defined(__s390x__))
// On these architectures, implement mmap with mmap2.
static int pagesize = 0;