From 47c21a73a731ab4aefec281b8873b7a39e7bc424 Mon Sep 17 00:00:00 2001 From: lanruo Date: Fri, 18 Aug 2023 14:13:45 +0800 Subject: [PATCH] fix loongarch64 build error and sw_64 build error (cherry picked from commit 6d6edb6bebc30538865479c815b2b3ed19fae822) --- fix-loongarch64-build-failed.patch | 53 ++++++++++++++++++++++++++++++ gperftools.spec | 19 ++++++++--- 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 fix-loongarch64-build-failed.patch diff --git a/fix-loongarch64-build-failed.patch b/fix-loongarch64-build-failed.patch new file mode 100644 index 0000000..800d8bc --- /dev/null +++ b/fix-loongarch64-build-failed.patch @@ -0,0 +1,53 @@ +From 1f9b13b0c08e0682fab3fbb962b504c2b85dc845 Mon Sep 17 00:00:00 2001 +From: yangchenguang +Date: Mon, 15 May 2023 11:14:21 +0800 +Subject: [PATCH] fix loongarch64 build failed + +Signed-off-by: yangchenguang +--- + src/base/linux_syscall_support.h | 5 +++++ + src/base/linuxthreads.cc | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h +index b807b11..a1afd87 100644 +--- a/src/base/linux_syscall_support.h ++++ b/src/base/linux_syscall_support.h +@@ -2773,6 +2773,7 @@ LSS_RETURN(int, __res); + LSS_INLINE _syscall3(int, fcntl, int, f, + int, c, long, a) + #endif ++#ifndef __loongarch__ + #if defined(__aarch64__) && defined (__ILP32__) + /* aarch64_ilp32 uses fstat64 for sys_fstat() */ + LSS_INLINE _syscall2_long(int, fstat, fstat64, int, f, +@@ -2780,6 +2781,10 @@ LSS_RETURN(int, __res); + #else + LSS_INLINE _syscall2(int, fstat, int, f, + struct kernel_stat*, b) ++#endif ++#else ++ LSS_INLINE _syscall2(int, statx, int, f, ++ struct kernel_stat*, b) + #endif + LSS_INLINE _syscall6(int, futex, int*, a, + int, o, int, v, +diff --git a/src/base/linuxthreads.cc b/src/base/linuxthreads.cc +index c28b1a9..2eb2816 100644 +--- a/src/base/linuxthreads.cc ++++ b/src/base/linuxthreads.cc +@@ -350,7 +350,11 @@ static void ListerThread(struct ListerParams *args) { + continue; + goto failure; + } ++#ifndef __loongarch__ + if (sys_fstat(proc, &proc_sb) < 0) ++#else ++ if (sys_statx(proc, &proc_sb) < 0) ++#endif + goto failure; + + /* Since we are suspending threads, we cannot call any libc +-- +2.33.0 + diff --git a/gperftools.spec b/gperftools.spec index 33aebc6..a5974a3 100644 --- a/gperftools.spec +++ b/gperftools.spec @@ -1,12 +1,13 @@ Name: gperftools Version: 2.10 -Release: 1 +Release: 2 Summary: high-performance malloc and performance analysis tools License: BSD-3-Clause URL: https://github.com/gperftools/gperftools Source0: https://github.com/gperftools/gperftools/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz Patch1: gperftools-generic-dynamic-tls.patch +Patch2: fix-loongarch64-build-failed.patch Patch9000: issue-1122-fix-bus-error-on-aarch64.patch Patch9001: skip-arm-in-stacktrace_unittest.patch @@ -73,6 +74,9 @@ CXXFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -D %configure \ %ifarch s390x aarch64 --disable-general-dynamic-tls \ +%endif +%ifarch sw_64 + --disable-cpu-profiler \ %endif --disable-dynamic-sized-delete-support \ @@ -92,17 +96,21 @@ LD_LIBRARY_PATH=./.libs make check #nothing to do %files libs +%ifnarch sw_64 %{_libdir}/libprofiler.so.* +%endif %{_libdir}/libtcmalloc*.so.* %files devel %{_includedir}/google/*.h %{_includedir}/gperftools/*.h +%ifnarch sw_64 %{_libdir}/libprofiler.so +%{_libdir}/libprofiler.*a +%endif %{_libdir}/libtcmalloc*.so %{_libdir}/pkgconfig/*.pc %{_docdir}/%{name}/* -%{_libdir}/libprofiler.*a %{_libdir}/libtcmalloc*.*a %files -n pprof @@ -110,6 +118,9 @@ LD_LIBRARY_PATH=./.libs make check %{_mandir}/man1/*.1.gz %changelog +* Mon May 15 2023 yangchenguang - 2.10-2 +- fix loongarch64 build error and sw_64 build error + * Thu Nov 10 2022 Liu Zixian - 2.10-1 - Update to 2.10 @@ -136,8 +147,8 @@ LD_LIBRARY_PATH=./.libs make check - avoid exceed int range when use heapchecker * Wed Oct 20 2021 zhangyiru - 2.8.1-3 -- enable make check && skip four arm testcases. - the reason is that arm do not have fully functional heap checker and +- enable make check && skip four arm testcases. + the reason is that arm do not have fully functional heap checker and the calling of unw_step in arm stacktrace_unittest is incorrect, but the function is not affected * Thu Jul 22 2021 zhangyiru - 2.8.1-2 -- Gitee