Fix build error for loongarch64

(cherry picked from commit 88f2726ee4c0ae7f92bf17229438d14debd58479)
This commit is contained in:
Wenlong Zhang 2024-03-07 06:10:25 +00:00 committed by openeuler-sync-bot
parent c31e06bcaa
commit 5d56ef2a99
2 changed files with 29 additions and 22 deletions

View File

@ -1,34 +1,37 @@
From a8c98703c8b7b1fc3ae104dce0bfd05dc92a1d7d Mon Sep 17 00:00:00 2001 From 560380189ff29687e011eada93774af59452f2c5 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn> Huang Yang <huangyang@loongson.cn> From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Mon, 14 Nov 2022 11:48:49 +0000 Date: Wed, 6 Mar 2024 03:28:59 +0000
Subject: [PATCH] add loongarch suopport for abseil-cpp Subject: [PATCH] add loongarch suopport for abseil-cpp
Signed-off-by: Wenlong Zhang <zhangwenlong@loongson.cn>
--- ---
absl/base/internal/direct_mmap.h | 3 ++- absl/base/internal/direct_mmap.h | 7 ++++++-
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h
index e492bb0..d11a64e 100644 index 1beb2ee..80fcbbb 100644
--- a/absl/base/internal/direct_mmap.h --- a/absl/base/internal/direct_mmap.h
+++ b/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, @@ -80,7 +80,8 @@ 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(__PPC__) && !defined(__PPC64__)) || \
(defined(__riscv) && __riscv_xlen == 32) || \ (defined(__riscv) && __riscv_xlen == 32) || \
+ defined(__loongarch64) || \
(defined(__s390__) && !defined(__s390x__)) || \ (defined(__s390__) && !defined(__s390x__)) || \
(defined(__sparc__) && !defined(__arch64__)) - (defined(__sparc__) && !defined(__arch64__))
+ (defined(__sparc__) && !defined(__arch64__)) || \
+ defined(__loongarch64)
// On these architectures, implement mmap with mmap2. // 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, static int pagesize = 0;
return __mmap2(start, length, prot, flags, fd, offset / pagesize); if (pagesize == 0) {
@@ -99,6 +100,10 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
// Workaround by invoking __mmap2() instead.
return __mmap2(start, length, prot, flags, fd,
static_cast<size_t>(offset / pagesize));
+#elif defined(__loongarch64)
+ return reinterpret_cast<void*>(
+ syscall(SYS_mmap, start, length, prot, flags, fd,
+ static_cast<unsigned long>(offset / pagesize))); // NOLINT
#else #else
return reinterpret_cast<void*>( return reinterpret_cast<void*>(
- syscall(SYS_mmap2, start, length, prot, flags, fd, 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 2.43.0

View File

@ -6,7 +6,7 @@
Name: abseil-cpp Name: abseil-cpp
Version: 20230802.1 Version: 20230802.1
Release: 2 Release: 3
Summary: C++ Common Libraries Summary: C++ Common Libraries
License: Apache-2.0 AND LicenseRef-Fedora-Public-Domain License: Apache-2.0 AND LicenseRef-Fedora-Public-Domain
@ -14,9 +14,7 @@ URL: https://abseil.io
Source0: https://github.com/abseil/abseil-cpp/archive/%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/abseil/abseil-cpp/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: abseil-cpp-20210324.2-sw.patch Patch1: abseil-cpp-20210324.2-sw.patch
%ifarch loongarch64
Patch100: 0001-add-loongarch-suopport-for-abseil-cpp.patch Patch100: 0001-add-loongarch-suopport-for-abseil-cpp.patch
%endif
BuildRequires: cmake ninja-build BuildRequires: cmake ninja-build
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -158,6 +156,12 @@ DESTDIR="%{buildroot}" %__cmake --install "%{_vpath_builddir}"
%{_libdir}/pkgconfig/*.pc %{_libdir}/pkgconfig/*.pc
%changelog %changelog
* Wed Mar 6 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 20230802.1-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Fix build error for loongarch64
* Tue Jan 23 2024 xinghe <xinghe2@h-partners.com> - 20230802.1-2 * Tue Jan 23 2024 xinghe <xinghe2@h-partners.com> - 20230802.1-2
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA