gperftools/fix-loongarch64-build-failed.patch
lanruo 47c21a73a7 fix loongarch64 build error and sw_64 build error
(cherry picked from commit 6d6edb6bebc30538865479c815b2b3ed19fae822)
2023-08-30 16:22:53 +08:00

54 lines
1.8 KiB
Diff

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