From a8c98703c8b7b1fc3ae104dce0bfd05dc92a1d7d Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn> Huang Yang <huangyang@loongson.cn>
Date: Mon, 14 Nov 2022 11:48:49 +0000
Subject: [PATCH] add loongarch suopport for abseil-cpp

Signed-off-by: Wenlong Zhang <zhangwenlong@loongson.cn>
---
 absl/base/internal/direct_mmap.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h
index e492bb0..d11a64e 100644
--- a/absl/base/internal/direct_mmap.h
+++ b/absl/base/internal/direct_mmap.h
@@ -79,6 +79,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
     (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) ||                   \
     (defined(__PPC__) && !defined(__PPC64__)) ||                             \
     (defined(__riscv) && __riscv_xlen == 32) ||                              \
+    defined(__loongarch64)	||					     \
     (defined(__s390__) && !defined(__s390x__)) ||                            \
     (defined(__sparc__) && !defined(__arch64__))
   // On these architectures, implement mmap with mmap2.
@@ -100,7 +101,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
   return __mmap2(start, length, prot, flags, fd, offset / pagesize);
 #else
   return reinterpret_cast<void*>(
-      syscall(SYS_mmap2, start, length, prot, flags, fd,
+      syscall(SYS_mmap, start, length, prot, flags, fd,
               static_cast<off_t>(offset / pagesize)));
 #endif
 #elif defined(__s390x__)
-- 
2.33.0

