From e61cbaa5ba0e28d8febac6de67177863842ae0e8 Mon Sep 17 00:00:00 2001 From: Jingyun Hua Date: Thu, 20 Jul 2023 02:54:35 +0000 Subject: [PATCH] fix build error on loongarch64 --- 0002-fix-build-error-on-loongarch64.patch | 45 +++++++++++++++++++++++ memleax.spec | 7 +++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0002-fix-build-error-on-loongarch64.patch diff --git a/0002-fix-build-error-on-loongarch64.patch b/0002-fix-build-error-on-loongarch64.patch new file mode 100644 index 0000000..f606cb2 --- /dev/null +++ b/0002-fix-build-error-on-loongarch64.patch @@ -0,0 +1,45 @@ +From 755743785892c3030674586ba84c0ad3de224b97 Mon Sep 17 00:00:00 2001 +From: Jingyun Hua +Date: Thu, 20 Jul 2023 02:46:28 +0000 +Subject: [PATCH] fix build error on loongarch64 + +--- + machines.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/machines.h b/machines.h +index 4472bd1..3e184d5 100644 +--- a/machines.h ++++ b/machines.h +@@ -90,23 +90,23 @@ static inline int is_breakpoint(pid_t pid, uintptr_t address) + #elif defined(MLX_LOONGARCH64) + static inline uintptr_t call_return_address(pid_t pid, registers_info_t *regs) + { +- return ptrace_get_data(pid, regs->gpr[3]); ++ return ptrace_get_data(pid, regs->regs[3]); + } + static inline uintptr_t call_return_value(registers_info_t *regs) + { +- return regs->gpr[1]; ++ return regs->regs[1]; + } + static inline uintptr_t call_arg1(pid_t pid, registers_info_t *regs) + { +- return regs->gpr[6]; ++ return regs->regs[6]; + } + static inline uintptr_t call_arg2(pid_t pid, registers_info_t *regs) + { +- return regs->gpr[7]; ++ return regs->regs[7]; + } + static inline uintptr_t pc_unwind(pid_t pid, registers_info_t *regs) + { +- return regs->pc; ++ return regs->csr_era; + } + static inline void set_breakpoint(pid_t pid, uintptr_t address, uintptr_t code) + { +-- +2.33.0 + diff --git a/memleax.spec b/memleax.spec index 548cebd..c093ccf 100644 --- a/memleax.spec +++ b/memleax.spec @@ -1,11 +1,12 @@ Name: memleax Version: 1.1.1 -Release: 5 +Release: 6 Summary: Memory lead detection tool License: GPLv2 URL: https://github.com/WuBingzheng/memleax Source0: https://github.com/WuBingzheng/memleax/archive/v%{version}.tar.gz#/memleax-%{version}.tar.gz Patch1: 0001-add-loongarch64-support.patch +Patch2: 0002-fix-build-error-on-loongarch64.patch BuildRequires: make libunwind-devel elfutils-devel gdb gcc %description @@ -27,6 +28,7 @@ If you want to debug multiple processes, just run multiple memleax. %setup -q %ifarch loongarch64 %patch1 -p1 +%patch2 -p1 %endif %build @@ -49,6 +51,9 @@ make install DESTDIR="%{buildroot}" %{_mandir}/man1/%{name}.1* %changelog +* Thu Jul 20 2023 huajingyun - 1.1.1-6 +- fix build error on loongarch64 + * Wed Dec 14 2022 doupengda - 1.1.1-5 - add loongarch64 support -- Gitee