fix loongarch64 build error and sw_64 build error

(cherry picked from commit 6d6edb6bebc30538865479c815b2b3ed19fae822)
This commit is contained in:
lanruo 2023-08-18 14:13:45 +08:00 committed by openeuler-sync-bot
parent 532ac0827b
commit 47c21a73a7
2 changed files with 68 additions and 4 deletions

View File

@ -0,0 +1,53 @@
From 1f9b13b0c08e0682fab3fbb962b504c2b85dc845 Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@kylinsec.com.cn>
Date: Mon, 15 May 2023 11:14:21 +0800
Subject: [PATCH] fix loongarch64 build failed
Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn>
---
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

View File

@ -1,12 +1,13 @@
Name: gperftools Name: gperftools
Version: 2.10 Version: 2.10
Release: 1 Release: 2
Summary: high-performance malloc and performance analysis tools Summary: high-performance malloc and performance analysis tools
License: BSD-3-Clause License: BSD-3-Clause
URL: https://github.com/gperftools/gperftools URL: https://github.com/gperftools/gperftools
Source0: https://github.com/gperftools/gperftools/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/gperftools/gperftools/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
Patch1: gperftools-generic-dynamic-tls.patch Patch1: gperftools-generic-dynamic-tls.patch
Patch2: fix-loongarch64-build-failed.patch
Patch9000: issue-1122-fix-bus-error-on-aarch64.patch Patch9000: issue-1122-fix-bus-error-on-aarch64.patch
Patch9001: skip-arm-in-stacktrace_unittest.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 \ %configure \
%ifarch s390x aarch64 %ifarch s390x aarch64
--disable-general-dynamic-tls \ --disable-general-dynamic-tls \
%endif
%ifarch sw_64
--disable-cpu-profiler \
%endif %endif
--disable-dynamic-sized-delete-support \ --disable-dynamic-sized-delete-support \
@ -92,17 +96,21 @@ LD_LIBRARY_PATH=./.libs make check
#nothing to do #nothing to do
%files libs %files libs
%ifnarch sw_64
%{_libdir}/libprofiler.so.* %{_libdir}/libprofiler.so.*
%endif
%{_libdir}/libtcmalloc*.so.* %{_libdir}/libtcmalloc*.so.*
%files devel %files devel
%{_includedir}/google/*.h %{_includedir}/google/*.h
%{_includedir}/gperftools/*.h %{_includedir}/gperftools/*.h
%ifnarch sw_64
%{_libdir}/libprofiler.so %{_libdir}/libprofiler.so
%{_libdir}/libprofiler.*a
%endif
%{_libdir}/libtcmalloc*.so %{_libdir}/libtcmalloc*.so
%{_libdir}/pkgconfig/*.pc %{_libdir}/pkgconfig/*.pc
%{_docdir}/%{name}/* %{_docdir}/%{name}/*
%{_libdir}/libprofiler.*a
%{_libdir}/libtcmalloc*.*a %{_libdir}/libtcmalloc*.*a
%files -n pprof %files -n pprof
@ -110,6 +118,9 @@ LD_LIBRARY_PATH=./.libs make check
%{_mandir}/man1/*.1.gz %{_mandir}/man1/*.1.gz
%changelog %changelog
* Mon May 15 2023 yangchenguang <yangchenguang@kylinsec.com.cn> - 2.10-2
- fix loongarch64 build error and sw_64 build error
* Thu Nov 10 2022 Liu Zixian <liuzixian4@huawei.com> - 2.10-1 * Thu Nov 10 2022 Liu Zixian <liuzixian4@huawei.com> - 2.10-1
- Update to 2.10 - Update to 2.10
@ -136,8 +147,8 @@ LD_LIBRARY_PATH=./.libs make check
- avoid exceed int range when use heapchecker - avoid exceed int range when use heapchecker
* Wed Oct 20 2021 zhangyiru <zhangyiru3@huawei.com> - 2.8.1-3 * Wed Oct 20 2021 zhangyiru <zhangyiru3@huawei.com> - 2.8.1-3
- enable make check && skip four arm testcases. - enable make check && skip four arm testcases.
the reason is that arm do not have fully functional heap checker and 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 the calling of unw_step in arm stacktrace_unittest is incorrect, but the function is not affected
* Thu Jul 22 2021 zhangyiru <zhangyiru3@huawei.com> - 2.8.1-2 * Thu Jul 22 2021 zhangyiru <zhangyiru3@huawei.com> - 2.8.1-2