ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile
new file mode 100644
index 0000000..4b94149
--- /dev/null
+++ b/package/devel/valgrind/Makefile
@@ -0,0 +1,200 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=valgrind
+PKG_VERSION:=3.23.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://sourceware.org/pub/valgrind/
+PKG_HASH:=c5c34a3380457b9b75606df890102e7df2c702b9420c2ebef9540f8b5d56264d
+
+PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
+PKG_LICENSE:=GPL-2.0+
+PKG_CPE_ID:=cpe:/a:valgrind:valgrind
+
+PKG_FIXUP = autoreconf
+PKG_INSTALL := 1
+PKG_BUILD_PARALLEL := 1
+PKG_BUILD_FLAGS:=no-mips16
+PKG_SSP:=0
+
+STRIP:=:
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/valgrind
+ SECTION:=devel
+ CATEGORY:=Development
+ DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm_v7||arm +libpthread +librt
+ TITLE:=debugging and profiling tools for Linux
+ URL:=http://www.valgrind.org
+endef
+
+define Package/valgrind/default
+ $(Package/valgrind)
+ DEPENDS := valgrind
+endef
+
+define Package/valgrind-cachegrind
+ $(Package/valgrind/default)
+ TITLE += (cache profiling)
+endef
+
+define Package/valgrind-callgrind
+ $(Package/valgrind/default)
+ TITLE += (callgraph profiling)
+endef
+
+define Package/valgrind-drd
+ $(Package/valgrind/default)
+ TITLE += (thread error detection)
+endef
+
+define Package/valgrind-massif
+ $(Package/valgrind/default)
+ TITLE += (heap profiling)
+endef
+
+define Package/valgrind-helgrind
+ $(Package/valgrind/default)
+ TITLE += (thread debugging)
+endef
+
+define Package/valgrind-vgdb
+ $(Package/valgrind/default)
+ TITLE += (GDB interface)
+endef
+
+define Package/valgrind/description
+ Valgrind is an award-winning suite of tools for debugging and
+ profiling Linux programs. With the tools that come with Valgrind,
+ you can automatically detect many memory management and threading
+ bugs, avoiding hours of frustrating bug-hunting, making your
+ programs more stable. You can also perform detailed profiling,
+ to speed up and reduce memory use of your programs.
+endef
+
+CPU := $(patsubst x86_64,amd64,$(patsubst x86,i386,$(patsubst um,$(ARCH),$(LINUX_KARCH))))
+
+CONFIGURE_VARS += \
+ UNAME_R=$(LINUX_VERSION)
+
+ifeq ($(CONFIG_ARCH_64BIT),y)
+ CONFIGURE_ARGS += \
+ --enable-only64bit
+ BITS := 64bit
+else
+ CONFIGURE_ARGS += \
+ --enable-only32bit
+ BITS := 32bit
+endif
+
+ifeq ($(CONFIG_arm_v7),y)
+ CONFIGURE_ARGS += --host=armv7-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))
+endif
+
+CONFIGURE_ARGS += \
+ --enable-lto \
+ --enable-tls \
+ --without-mpicc \
+
+define Package/valgrind/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ ./files/default.supp \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-core*.xml \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(BITS)-linux*.xml \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \
+ $(1)/usr/lib/valgrind/
+
+ifneq ($(ARCH),aarch64)
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \
+ $(1)/usr/lib/valgrind/
+endif
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-*
+endef
+
+define Package/valgrind-cachegrind/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \
+ $(1)/usr/lib/valgrind/
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-*
+endef
+
+define Package/valgrind-callgrind/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \
+ $(1)/usr/lib/valgrind/
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-*
+endef
+
+define Package/valgrind-drd/install
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \
+ $(1)/usr/lib/valgrind/
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-*
+endef
+
+define Package/valgrind-massif/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \
+ $(1)/usr/lib/valgrind/
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-*
+endef
+
+define Package/valgrind-helgrind/install
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \
+ $(1)/usr/lib/valgrind/
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip -g",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-*
+endef
+
+define Package/valgrind-vgdb/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/
+ $(patsubst STRIP=%,STRIP="$(TARGET_CROSS)strip",$(RSTRIP)) $(PKG_INSTALL_DIR)/usr/bin
+endef
+
+$(eval $(call BuildPackage,valgrind))
+$(eval $(call BuildPackage,valgrind-cachegrind))
+$(eval $(call BuildPackage,valgrind-callgrind))
+$(eval $(call BuildPackage,valgrind-drd))
+$(eval $(call BuildPackage,valgrind-massif))
+$(eval $(call BuildPackage,valgrind-helgrind))
+$(eval $(call BuildPackage,valgrind-vgdb))
diff --git a/package/devel/valgrind/files/default.supp b/package/devel/valgrind/files/default.supp
new file mode 100644
index 0000000..beff559
--- /dev/null
+++ b/package/devel/valgrind/files/default.supp
@@ -0,0 +1,42 @@
+{
+ ld(Addr1)
+ Memcheck:Addr1
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ ld(Addr2)
+ Memcheck:Addr2
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ ld(Addr4)
+ Memcheck:Addr4
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ ld(Cond)
+ Memcheck:Cond
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ strlen(Cond)
+ Memcheck:Cond
+ fun:strlen
+ fun:*
+}
+{
+ strnlen(Cond)
+ Memcheck:Cond
+ fun:strnlen
+ fun:*
+}
+{
+ index(Cond)
+ Memcheck:Cond
+ fun:index
+ fun:*
+}
diff --git a/package/devel/valgrind/patches/010-486180-Valgrind-MIPS-VexGuestArchState-has-no-member.patch b/package/devel/valgrind/patches/010-486180-Valgrind-MIPS-VexGuestArchState-has-no-member.patch
new file mode 100644
index 0000000..912ac38
--- /dev/null
+++ b/package/devel/valgrind/patches/010-486180-Valgrind-MIPS-VexGuestArchState-has-no-member.patch
@@ -0,0 +1,61 @@
+From 7214886886bce9029f325214156c02dcfff760d5 Mon Sep 17 00:00:00 2001
+From: Paul Floyd <pjfloyd@wanadoo.fr>
+Date: Sat, 27 Apr 2024 13:07:07 +0200
+Subject: 486180 - [Valgrind][MIPS] 'VexGuestArchState' has no member named
+ 'guest_IP_AT_SYSCALL'
+
+---
+ NEWS | 34 ++++++++++++++++++++++++++++++++++
+ VEX/priv/guest_mips_helpers.c | 4 ++++
+ VEX/pub/libvex_guest_mips32.h | 6 +++---
+ VEX/pub/libvex_guest_mips64.h | 2 ++
+ configure.ac | 6 +++---
+ 5 files changed, 46 insertions(+), 6 deletions(-)
+
+--- a/VEX/priv/guest_mips_helpers.c
++++ b/VEX/priv/guest_mips_helpers.c
+@@ -187,6 +187,8 @@ void LibVEX_GuestMIPS32_initialise( /*OU
+ vex_state->guest_w1.w64[1] = 0;
+ vex_state->guest_w2.w64[0] = 0;
+ vex_state->guest_w2.w64[1] = 0;
++
++ vex_state->guest_IP_AT_SYSCALL = 0;
+ }
+
+ void LibVEX_GuestMIPS64_initialise ( /*OUT*/ VexGuestMIPS64State * vex_state )
+@@ -294,6 +296,8 @@ void LibVEX_GuestMIPS64_initialise ( /*O
+ vex_state->guest_LLaddr = 0xFFFFFFFFFFFFFFFFULL;
+ vex_state->guest_LLdata = 0;
+
++ vex_state->guest_IP_AT_SYSCALL = 0;
++
+ vex_state->guest_MSACSR = 0;
+ }
+
+--- a/VEX/pub/libvex_guest_mips32.h
++++ b/VEX/pub/libvex_guest_mips32.h
+@@ -188,10 +188,10 @@ typedef
+
+ /* 1016 */ UInt guest_MSACSR;
+
+- /* 1020 */ UInt _padding3;
++ /* 1020 */ UInt guest_IP_AT_SYSCALL;
+
+- /* 1020 */ ULong guest_LLdata64;
+- /* 1028 */ ULong _padding4;
++ /* 1024 */ ULong guest_LLdata64;
++ /* 1032 */ ULong _padding3;
+ } VexGuestMIPS32State;
+ /*---------------------------------------------------------------*/
+ /*--- Utility functions for MIPS32 guest stuff. ---*/
+--- a/VEX/pub/libvex_guest_mips64.h
++++ b/VEX/pub/libvex_guest_mips64.h
+@@ -184,6 +184,8 @@ typedef
+ /* 1144 */ UInt guest_MSACSR;
+
+ /* 1148 */ UInt _padding2;
++ /* 1152 */ ULong guest_IP_AT_SYSCALL;
++ /* 1160 */ ULong _padding3;
+
+ } VexGuestMIPS64State;
+
diff --git a/package/devel/valgrind/patches/020-mips-skip-using-shared-syscall-numbers-for-mips32.patch b/package/devel/valgrind/patches/020-mips-skip-using-shared-syscall-numbers-for-mips32.patch
new file mode 100644
index 0000000..a519341
--- /dev/null
+++ b/package/devel/valgrind/patches/020-mips-skip-using-shared-syscall-numbers-for-mips32.patch
@@ -0,0 +1,159 @@
+From 54d6ad3348fb50f5b972fe9c05d0d8757bfe73ba Mon Sep 17 00:00:00 2001
+From: Aleksandar Rikalo <arikalo@gmail.com>
+Date: Fri, 10 May 2024 17:59:28 +0200
+Subject: mips: skip using shared syscall numbers for mips32
+
+mips does not use shared syscall numbers, so we can not use
+vki-scnums-shared-linux.h.
+
+This partially fixes KDE #444781.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
+---
+ coregrind/m_syswrap/syswrap-mips32-linux.c | 1 +
+ include/pub_tool_vkiscnums_asm.h | 2 -
+ include/vki/vki-scnums-mips32-linux.h | 105 ++++++++++++++++-----
+ 3 files changed, 83 insertions(+), 25 deletions(-)
+
+--- a/coregrind/m_syswrap/syswrap-mips32-linux.c
++++ b/coregrind/m_syswrap/syswrap-mips32-linux.c
+@@ -1110,6 +1110,7 @@ static SyscallTableEntry syscall_main_ta
+ LINX_ (__NR_pwritev2, sys_pwritev2), // 362
+ //..
+ LINXY(__NR_statx, sys_statx), // 366
++ GENX_(__NR_rseq, sys_ni_syscall), // 367
+
+ LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403
+ LINX_(__NR_clock_settime64, sys_clock_settime64), // 404
+--- a/include/pub_tool_vkiscnums_asm.h
++++ b/include/pub_tool_vkiscnums_asm.h
+@@ -63,8 +63,6 @@
+ # include "vki/vki-scnums-arm64-linux.h"
+
+ #elif defined(VGP_mips32_linux)
+-# include "vki/vki-scnums-shared-linux.h"
+-# include "vki/vki-scnums-32bit-linux.h"
+ # include "vki/vki-scnums-mips32-linux.h"
+
+ #elif defined(VGP_nanomips_linux)
+--- a/include/vki/vki-scnums-mips32-linux.h
++++ b/include/vki/vki-scnums-mips32-linux.h
+@@ -380,35 +380,94 @@
+ #define __NR_setns (__NR_Linux + 343)
+ #define __NR_process_vm_readv (__NR_Linux + 345)
+ #define __NR_process_vm_writev (__NR_Linux + 346)
+-#define __NR_kcmp (__NR_Linux + 347)
+-#define __NR_finit_module (__NR_Linux + 348)
+-#define __NR_sched_setattr (__NR_Linux + 349)
+-#define __NR_sched_getattr (__NR_Linux + 350)
+-#define __NR_renameat2 (__NR_Linux + 351)
+-#define __NR_seccomp (__NR_Linux + 352)
+-#define __NR_getrandom (__NR_Linux + 353)
+-#define __NR_memfd_create (__NR_Linux + 354)
+-#define __NR_bpf (__NR_Linux + 355)
+-#define __NR_execveat (__NR_Linux + 356)
+-#define __NR_userfaultfd (__NR_Linux + 357)
+-#define __NR_membarrier (__NR_Linux + 358)
+-#define __NR_mlock2 (__NR_Linux + 359)
+-#define __NR_copy_file_range (__NR_Linux + 360)
+-#define __NR_preadv2 (__NR_Linux + 361)
+-#define __NR_pwritev2 (__NR_Linux + 362)
+-#define __NR_pkey_mprotect (__NR_Linux + 363)
+-#define __NR_pkey_alloc (__NR_Linux + 364)
+-#define __NR_pkey_free (__NR_Linux + 365)
+-#define __NR_statx (__NR_Linux + 366)
+-
++#define __NR_kcmp (__NR_Linux + 347)
++#define __NR_finit_module (__NR_Linux + 348)
++#define __NR_sched_setattr (__NR_Linux + 349)
++#define __NR_sched_getattr (__NR_Linux + 350)
++#define __NR_renameat2 (__NR_Linux + 351)
++#define __NR_seccomp (__NR_Linux + 352)
++#define __NR_getrandom (__NR_Linux + 353)
++#define __NR_memfd_create (__NR_Linux + 354)
++#define __NR_bpf (__NR_Linux + 355)
++#define __NR_execveat (__NR_Linux + 356)
++#define __NR_userfaultfd (__NR_Linux + 357)
++#define __NR_membarrier (__NR_Linux + 358)
++#define __NR_mlock2 (__NR_Linux + 359)
++#define __NR_copy_file_range (__NR_Linux + 360)
++#define __NR_preadv2 (__NR_Linux + 361)
++#define __NR_pwritev2 (__NR_Linux + 362)
++#define __NR_pkey_mprotect (__NR_Linux + 363)
++#define __NR_pkey_alloc (__NR_Linux + 364)
++#define __NR_pkey_free (__NR_Linux + 365)
++#define __NR_statx (__NR_Linux + 366)
++#define __NR_rseq (__NR_Linux + 367)
++#define __NR_io_pgetevents (__NR_Linux + 368)
++#define __NR_semget (__NR_Linux + 393)
++#define __NR_semctl (__NR_Linux + 394)
++#define __NR_shmget (__NR_Linux + 395)
++#define __NR_shmctl (__NR_Linux + 396)
++#define __NR_shmat (__NR_Linux + 397)
++#define __NR_shmdt (__NR_Linux + 398)
++#define __NR_msgget (__NR_Linux + 399)
++#define __NR_msgsnd (__NR_Linux + 400)
++#define __NR_msgrcv (__NR_Linux + 401)
++#define __NR_msgctl (__NR_Linux + 402)
++#define __NR_clock_gettime64 (__NR_Linux + 403)
++#define __NR_clock_settime64 (__NR_Linux + 404)
++#define __NR_clock_adjtime64 (__NR_Linux + 405)
++#define __NR_clock_getres_time64 (__NR_Linux + 406)
++#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
++#define __NR_timer_gettime64 (__NR_Linux + 408)
++#define __NR_timer_settime64 (__NR_Linux + 409)
++#define __NR_timerfd_gettime64 (__NR_Linux + 410)
++#define __NR_timerfd_settime64 (__NR_Linux + 411)
++#define __NR_utimensat_time64 (__NR_Linux + 412)
++#define __NR_pselect6_time64 (__NR_Linux + 413)
++#define __NR_ppoll_time64 (__NR_Linux + 414)
++#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
++#define __NR_recvmmsg_time64 (__NR_Linux + 417)
++#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
++#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
++#define __NR_semtimedop_time64 (__NR_Linux + 420)
++#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
++#define __NR_futex_time64 (__NR_Linux + 422)
++#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
++#define __NR_pidfd_send_signal (__NR_Linux + 424)
++#define __NR_io_uring_setup (__NR_Linux + 425)
++#define __NR_io_uring_enter (__NR_Linux + 426)
++#define __NR_io_uring_register (__NR_Linux + 427)
++#define __NR_open_tree (__NR_Linux + 428)
++#define __NR_move_mount (__NR_Linux + 429)
++#define __NR_fsopen (__NR_Linux + 430)
++#define __NR_fsconfig (__NR_Linux + 431)
++#define __NR_fsmount (__NR_Linux + 432)
++#define __NR_fspick (__NR_Linux + 433)
++#define __NR_pidfd_open (__NR_Linux + 434)
++#define __NR_clone3 (__NR_Linux + 435)
++#define __NR_close_range (__NR_Linux + 436)
++#define __NR_openat2 (__NR_Linux + 437)
++#define __NR_pidfd_getfd (__NR_Linux + 438)
++#define __NR_faccessat2 (__NR_Linux + 439)
++#define __NR_process_madvise (__NR_Linux + 440)
++#define __NR_epoll_pwait2 (__NR_Linux + 441)
++#define __NR_mount_setattr (__NR_Linux + 442)
++#define __NR_quotactl_fd (__NR_Linux + 443)
++#define __NR_landlock_create_ruleset (__NR_Linux + 444)
++#define __NR_landlock_add_rule (__NR_Linux + 445)
++#define __NR_landlock_restrict_self (__NR_Linux + 446)
++#define __NR_process_mrelease (__NR_Linux + 448)
++#define __NR_futex_waitv (__NR_Linux + 449)
++#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
++#define __NR_cachestat (__NR_Linux + 451)
++#define __NR_fchmodat2 (__NR_Linux + 452)
+ /*
+ * Offset of the last Linux o32 flavoured syscall
+ */
+-#define __NR_Linux_syscalls 366
++#define __NR_Linux_syscalls 366
+
+
+ #define __NR_O32_Linux 4000
+-#define __NR_O32_Linux_syscalls 366
++#define __NR_O32_Linux_syscalls 366
+
+
+ #endif /* __VKI_SCNUMS_MIPS32_LINUX_H */
diff --git a/package/devel/valgrind/patches/021-mips-skip-using-shared-syscall-numbers-for-mips64.patch b/package/devel/valgrind/patches/021-mips-skip-using-shared-syscall-numbers-for-mips64.patch
new file mode 100644
index 0000000..759c5fd
--- /dev/null
+++ b/package/devel/valgrind/patches/021-mips-skip-using-shared-syscall-numbers-for-mips64.patch
@@ -0,0 +1,152 @@
+From efaa17e53a750d5f0f4c138b507b1b104729ed67 Mon Sep 17 00:00:00 2001
+From: Petar Jovanovic <mips32r2@gmail.com>
+Date: Mon, 24 Jun 2024 10:33:46 +0000
+Subject: mips: skip using shared syscall numbers for mips64
+
+mips does not use shared syscall numbers, so we can not use
+vki-scnums-shared-linux.h.
+
+This fixes KDE #444781.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
+---
+ coregrind/m_syswrap/syswrap-mips64-linux.c | 1 +
+ include/pub_tool_vkiscnums_asm.h | 1 -
+ include/vki/vki-scnums-mips64-linux.h | 98 ++++++++++++++++++++++
+ 3 files changed, 99 insertions(+), 1 deletion(-)
+
+--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
++++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
+@@ -813,6 +813,7 @@ static SyscallTableEntry syscall_main_ta
+ LINX_ (__NR_pwritev2, sys_pwritev2),
+ LINX_ (__NR_syncfs, sys_syncfs),
+ LINXY (__NR_statx, sys_statx),
++ GENX_ (__NR_rseq, sys_ni_syscall),
+ LINX_ (__NR_setns, sys_setns),
+ LINXY (__NR_io_uring_setup, sys_io_uring_setup),
+ LINXY (__NR_io_uring_enter, sys_io_uring_enter),
+--- a/include/pub_tool_vkiscnums_asm.h
++++ b/include/pub_tool_vkiscnums_asm.h
+@@ -70,7 +70,6 @@
+ # include "vki/vki-scnums-shared-linux.h"
+
+ #elif defined(VGP_mips64_linux)
+-# include "vki/vki-scnums-shared-linux.h"
+ # include "vki/vki-scnums-mips64-linux.h"
+
+ #elif defined(VGP_x86_freebsd) || defined(VGP_amd64_freebsd) || defined(VGP_arm64_freebsd)
+--- a/include/vki/vki-scnums-mips64-linux.h
++++ b/include/vki/vki-scnums-mips64-linux.h
+@@ -362,6 +362,45 @@
+ #define __NR_pkey_alloc (__NR_Linux + 324)
+ #define __NR_pkey_free (__NR_Linux + 325)
+ #define __NR_statx (__NR_Linux + 326)
++#define __NR_rseq (__NR_Linux + 327)
++#define __NR_io_pgetevents (__NR_Linux + 328)
++#define __NR_pidfd_send_signal (__NR_Linux + 424)
++#define __NR_io_uring_setup (__NR_Linux + 425)
++#define __NR_io_uring_enter (__NR_Linux + 426)
++#define __NR_io_uring_register (__NR_Linux + 427)
++#define __NR_open_tree (__NR_Linux + 428)
++#define __NR_move_mount (__NR_Linux + 429)
++#define __NR_fsopen (__NR_Linux + 430)
++#define __NR_fsconfig (__NR_Linux + 431)
++#define __NR_fsmount (__NR_Linux + 432)
++#define __NR_fspick (__NR_Linux + 433)
++#define __NR_pidfd_open (__NR_Linux + 434)
++#define __NR_clone3 (__NR_Linux + 435)
++#define __NR_close_range (__NR_Linux + 436)
++#define __NR_openat2 (__NR_Linux + 437)
++#define __NR_pidfd_getfd (__NR_Linux + 438)
++#define __NR_faccessat2 (__NR_Linux + 439)
++#define __NR_process_madvise (__NR_Linux + 440)
++#define __NR_epoll_pwait2 (__NR_Linux + 441)
++#define __NR_mount_setattr (__NR_Linux + 442)
++#define __NR_quotactl_fd (__NR_Linux + 443)
++#define __NR_landlock_create_ruleset (__NR_Linux + 444)
++#define __NR_landlock_add_rule (__NR_Linux + 445)
++#define __NR_landlock_restrict_self (__NR_Linux + 446)
++#define __NR_process_mrelease (__NR_Linux + 448)
++#define __NR_futex_waitv (__NR_Linux + 449)
++#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
++#define __NR_cachestat (__NR_Linux + 451)
++#define __NR_fchmodat2 (__NR_Linux + 452)
++#define __NR_map_shadow_stack (__NR_Linux + 453)
++#define __NR_futex_wake (__NR_Linux + 454)
++#define __NR_futex_wait (__NR_Linux + 455)
++#define __NR_futex_requeue (__NR_Linux + 456)
++#define __NR_statmount (__NR_Linux + 457)
++#define __NR_listmount (__NR_Linux + 458)
++#define __NR_lsm_get_self_attr (__NR_Linux + 459)
++#define __NR_lsm_set_self_attr (__NR_Linux + 460)
++#define __NR_lsm_list_modules (__NR_Linux + 461)
+
+ #elif defined(VGABI_N32)
+
+@@ -701,6 +740,65 @@
+ #define __NR_pkey_alloc (__NR_Linux + 328)
+ #define __NR_pkey_free (__NR_Linux + 329)
+ #define __NR_statx (__NR_Linux + 330)
++#define __NR_rseq (__NR_Linux + 331)
++#define __NR_io_pgetevents (__NR_Linux + 332)
++#define __NR_clock_gettime64 (__NR_Linux + 403)
++#define __NR_clock_settime64 (__NR_Linux + 404)
++#define __NR_clock_adjtime64 (__NR_Linux + 405)
++#define __NR_clock_getres_time64 (__NR_Linux + 406)
++#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
++#define __NR_timer_gettime64 (__NR_Linux + 408)
++#define __NR_timer_settime64 (__NR_Linux + 409)
++#define __NR_timerfd_gettime64 (__NR_Linux + 410)
++#define __NR_timerfd_settime64 (__NR_Linux + 411)
++#define __NR_utimensat_time64 (__NR_Linux + 412)
++#define __NR_pselect6_time64 (__NR_Linux + 413)
++#define __NR_ppoll_time64 (__NR_Linux + 414)
++#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
++#define __NR_recvmmsg_time64 (__NR_Linux + 417)
++#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
++#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
++#define __NR_semtimedop_time64 (__NR_Linux + 420)
++#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
++#define __NR_futex_time64 (__NR_Linux + 422)
++#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
++#define __NR_pidfd_send_signal (__NR_Linux + 424)
++#define __NR_io_uring_setup (__NR_Linux + 425)
++#define __NR_io_uring_enter (__NR_Linux + 426)
++#define __NR_io_uring_register (__NR_Linux + 427)
++#define __NR_open_tree (__NR_Linux + 428)
++#define __NR_move_mount (__NR_Linux + 429)
++#define __NR_fsopen (__NR_Linux + 430)
++#define __NR_fsconfig (__NR_Linux + 431)
++#define __NR_fsmount (__NR_Linux + 432)
++#define __NR_fspick (__NR_Linux + 433)
++#define __NR_pidfd_open (__NR_Linux + 434)
++#define __NR_clone3 (__NR_Linux + 435)
++#define __NR_close_range (__NR_Linux + 436)
++#define __NR_openat2 (__NR_Linux + 437)
++#define __NR_pidfd_getfd (__NR_Linux + 438)
++#define __NR_faccessat2 (__NR_Linux + 439)
++#define __NR_process_madvise (__NR_Linux + 440)
++#define __NR_epoll_pwait2 (__NR_Linux + 441)
++#define __NR_mount_setattr (__NR_Linux + 442)
++#define __NR_quotactl_fd (__NR_Linux + 443)
++#define __NR_landlock_create_ruleset (__NR_Linux + 444)
++#define __NR_landlock_add_rule (__NR_Linux + 445)
++#define __NR_landlock_restrict_self (__NR_Linux + 446)
++#define __NR_process_mrelease (__NR_Linux + 448)
++#define __NR_futex_waitv (__NR_Linux + 449)
++#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
++#define __NR_cachestat (__NR_Linux + 451)
++#define __NR_fchmodat2 (__NR_Linux + 452)
++#define __NR_map_shadow_stack (__NR_Linux + 453)
++#define __NR_futex_wake (__NR_Linux + 454)
++#define __NR_futex_wait (__NR_Linux + 455)
++#define __NR_futex_requeue (__NR_Linux + 456)
++#define __NR_statmount (__NR_Linux + 457)
++#define __NR_listmount (__NR_Linux + 458)
++#define __NR_lsm_get_self_attr (__NR_Linux + 459)
++#define __NR_lsm_set_self_attr (__NR_Linux + 460)
++#define __NR_lsm_list_modules (__NR_Linux + 461)
+
+ #else
+ #error unknown mips64 abi
diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch
new file mode 100644
index 0000000..d771943
--- /dev/null
+++ b/package/devel/valgrind/patches/100-fix_configure_check.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -381,7 +381,7 @@ case "${host_os}" in
+ # Ok, this is linux. Check the kernel version
+ AC_MSG_CHECKING([for the kernel version])
+
+- kernel=`uname -r`
++ kernel=${UNAME_R:-`uname -r`}
+
+ case "${kernel}" in
+ 0.*|1.*|2.0.*|2.1.*|2.2.*|2.3.*|2.4.*|2.5.*)
diff --git a/package/devel/valgrind/patches/130-mips_fix_soft_float.patch b/package/devel/valgrind/patches/130-mips_fix_soft_float.patch
new file mode 100644
index 0000000..f861646
--- /dev/null
+++ b/package/devel/valgrind/patches/130-mips_fix_soft_float.patch
@@ -0,0 +1,68 @@
+Disable the valgrind helpers which use MIPS floating point operations
+when floating point support is deactivated in the toolchain.
+
+The fix from this commit is not sufficient any more:
+https://sourceware.org/git/?p=valgrind.git;a=commitdiff;h=869fcf2f6739f17b4eff36ec68f8dca826c8afeb
+
+This fixes the following error message when compiling with a GCC 10 MIPS BE 32:
+---------------------------------------------------------
+../VEX/priv/guest_mips_helpers.c: In function 'mips_dirtyhelper_calculate_FCSR_fp32':
+../VEX/priv/guest_mips_helpers.c:640:10: error: the register '$f21' cannot be clobbered in 'asm' for the current target
+ 640 | ASM_VOLATILE_UNARY32_DOUBLE(round.w.d)
+ | ^
+---------------------------------------------------------
+
+--- a/VEX/priv/guest_mips_helpers.c
++++ b/VEX/priv/guest_mips_helpers.c
+@@ -620,6 +620,7 @@ extern UInt mips_dirtyhelper_calculate_F
+ flt_op inst )
+ {
+ UInt ret = 0;
++#ifndef __mips_soft_float
+ #if defined(__mips__)
+ VexGuestMIPS32State* guest_state = (VexGuestMIPS32State*)gs;
+ UInt loFsVal, hiFsVal, loFtVal, hiFtVal;
+@@ -702,6 +703,7 @@ extern UInt mips_dirtyhelper_calculate_F
+ break;
+ }
+ #endif
++#endif
+ return ret;
+ }
+
+@@ -711,6 +713,7 @@ extern UInt mips_dirtyhelper_calculate_F
+ flt_op inst )
+ {
+ UInt ret = 0;
++#ifndef __mips_soft_float
+ #if defined(__mips__) && ((__mips == 64) || \
+ (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)))
+ #if defined(VGA_mips32)
+@@ -863,6 +866,7 @@ extern UInt mips_dirtyhelper_calculate_F
+ break;
+ }
+ #endif
++#endif
+ return ret;
+ }
+
+--- a/coregrind/m_machine.c
++++ b/coregrind/m_machine.c
+@@ -2119,6 +2119,7 @@ Bool VG_(machine_get_hwcaps)( void )
+ we are using alternative way to determine FP mode */
+ ULong result = 0;
+
++#ifndef __mips_soft_float
+ if (!VG_MINIMAL_SETJMP(env_unsup_insn)) {
+ __asm__ volatile (
+ ".set push\n\t"
+@@ -2136,6 +2137,9 @@ Bool VG_(machine_get_hwcaps)( void )
+
+ fpmode = (result != 0x3FF0000000000000ull);
+ }
++#else
++ fpmode = 0;
++#endif
+ }
+
+ if (fpmode != 0)