Make the source buildable on mips64.
Created attachment 183887 [details] proposed patch
The fix in include/vki/vki-scnums-mips32-linux.h looks correct for mips32. include/vki/vki-scnums-mips64-linux.h already has definitions for statmount and listmount. Did you mean mips32? Maybe as Secondary arch on mips64?
I don't have access to mips32 hardware. This somehow (indirectly?) makes a difference on a mips64 when compiling the sources. I'm trying to reproduce and confirm now, but that takes time, because the HW I have access to, is preeeety sloooow :)
You seem to be fixing the mips32 syscall wrappers, so I assume you are building (also) mips32. Probably as a secondary architecture. It will say after configure. Something like the following on amd64: Maximum build arch: amd64 Primary build arch: amd64 Secondary build arch: x86 Build OS: linux Link Time Optimisation: no Primary build target: AMD64_LINUX Secondary build target: X86_LINUX Platform variant: vanilla You can double check by only building one or the other with --enable-only32bit or --enable-only64bit Anyway, I believe the patch is good, but the description (and this bug subject) probably should say mips32 if that is what you are fixing.
Hah, so mid-air collision :) But what I was about to submit at about the same time as you: I've rebuilt git head with this patch on top on the following test system: mcermak@cfarm230:~/valgrind$ uname -a Linux cfarm230 4.9.79-UBNT_E300 #9 SMP Tue Jul 13 13:04:47 BST 2021 mips64 GNU/Linux mcermak@cfarm230:~/valgrind$ Then I've reverted it and that gives the following build error: [ ... stuff deleted ... ] mv -f m_aspacemgr/.deps/libcoregrind_mips32_linux_a-aspacemgr-linux.Tpo m_aspacemgr/.deps/libcoregrind_mips32_linux_a-aspacemgr-linux.Po gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include -I../VEX/pub -I../VEX/pub -DVGA_mips32=1 -DVGO_linux=1 -DVGP_mips32_linux=1 -DVGPV_mips32_linux_vanilla=1 -DVGABI_64 -I../coregrind -DVG_LIBDIR="\"/dev/null/libexec/valgrind"\" -DVG_PLATFORM="\"mips32-linux\"" -mips32 -mabi=32 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-unused-result -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-signedness -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op -Wimplicit-fallthrough=2 -Wold-style-declaration -finline-functions -fno-stack-protector -fno-strict-aliasing -fno-builtin -DENABLE_LINUX_TICKET_LOCK -MT m_syswrap/libcoregrind_mips32_linux_a-syswrap-mips32-linux.o -MD -MP -MF m_syswrap/.deps/libcoregrind_mips32_linux_a-syswrap-mips32-linux.Tpo -c -o m_syswrap/libcoregrind_mips32_linux_a-syswrap-mips32-linux.o `test -f 'm_syswrap/syswrap-mips32-linux.c' || echo './'`m_syswrap/syswrap-mips32-linux.c In file included from m_syswrap/syswrap-mips32-linux.c:48: m_syswrap/syswrap-mips32-linux.c:1185:10: error: ‘__NR_statmount’ undeclared here (not in a function); did you mean ‘vki_statmount’? LINXY(__NR_statmount, sys_statmount), // 457 ^~~~~~~~~~~~~~ m_syswrap/priv_types_n_macros.h:327:5: note: in definition of macro ‘WRAPPER_ENTRY_XY’ [sysno] = { vgSysWrap_##auxstr##_##name##_before, \ ^~~~~ m_syswrap/syswrap-mips32-linux.c:1185:4: note: in expansion of macro ‘LINXY’ LINXY(__NR_statmount, sys_statmount), // 457 ^~~~~ m_syswrap/syswrap-mips32-linux.c:1185:10: error: array index in initializer not of integer type LINXY(__NR_statmount, sys_statmount), // 457 ^~~~~~~~~~~~~~ m_syswrap/priv_types_n_macros.h:327:5: note: in definition of macro ‘WRAPPER_ENTRY_XY’ [sysno] = { vgSysWrap_##auxstr##_##name##_before, \ ^~~~~ m_syswrap/syswrap-mips32-linux.c:1185:4: note: in expansion of macro ‘LINXY’ LINXY(__NR_statmount, sys_statmount), // 457 ^~~~~ m_syswrap/syswrap-mips32-linux.c:1185:10: note: (near initialization for ‘syscall_main_table’) LINXY(__NR_statmount, sys_statmount), // 457 ^~~~~~~~~~~~~~ m_syswrap/priv_types_n_macros.h:327:5: note: in definition of macro ‘WRAPPER_ENTRY_XY’ [sysno] = { vgSysWrap_##auxstr##_##name##_before, \ ^~~~~ m_syswrap/syswrap-mips32-linux.c:1185:4: note: in expansion of macro ‘LINXY’ LINXY(__NR_statmount, sys_statmount), // 457 ^~~~~ m_syswrap/syswrap-mips32-linux.c:1186:10: error: ‘__NR_listmount’ undeclared here (not in a function); did you mean ‘vki_statmount’? LINXY(__NR_listmount, sys_listmount), // 458 ^~~~~~~~~~~~~~ m_syswrap/priv_types_n_macros.h:327:5: note: in definition of macro ‘WRAPPER_ENTRY_XY’ [sysno] = { vgSysWrap_##auxstr##_##name##_before, \ ^~~~~ m_syswrap/syswrap-mips32-linux.c:1186:4: note: in expansion of macro ‘LINXY’ LINXY(__NR_listmount, sys_listmount), // 458 ^~~~~ m_syswrap/syswrap-mips32-linux.c:1186:10: error: array index in initializer not of integer type LINXY(__NR_listmount, sys_listmount), // 458 ^~~~~~~~~~~~~~ m_syswrap/priv_types_n_macros.h:327:5: note: in definition of macro ‘WRAPPER_ENTRY_XY’ [sysno] = { vgSysWrap_##auxstr##_##name##_before, \ ^~~~~ m_syswrap/syswrap-mips32-linux.c:1186:4: note: in expansion of macro ‘LINXY’ LINXY(__NR_listmount, sys_listmount), // 458 ^~~~~ m_syswrap/syswrap-mips32-linux.c:1186:10: note: (near initialization for ‘syscall_main_table’) LINXY(__NR_listmount, sys_listmount), // 458 ^~~~~~~~~~~~~~ m_syswrap/priv_types_n_macros.h:327:5: note: in definition of macro ‘WRAPPER_ENTRY_XY’ [sysno] = { vgSysWrap_##auxstr##_##name##_before, \ ^~~~~ m_syswrap/syswrap-mips32-linux.c:1186:4: note: in expansion of macro ‘LINXY’ LINXY(__NR_listmount, sys_listmount), // 458 ^~~~~ make[3]: *** [Makefile:9478: m_syswrap/libcoregrind_mips32_linux_a-syswrap-mips32-linux.o] Error 1 make[3]: *** Waiting for unfinished jobs.... mv -f m_syswrap/.deps/libcoregrind_mips32_linux_a-syswrap-generic.Tpo m_syswrap/.deps/libcoregrind_mips32_linux_a-syswrap-generic.Po mv -f m_debuginfo/.deps/libcoregrind_mips32_linux_a-readelf.Tpo m_debuginfo/.deps/libcoregrind_mips32_linux_a-readelf.Po mv -f m_syswrap/.deps/libcoregrind_mips32_linux_a-syswrap-linux.Tpo m_syswrap/.deps/libcoregrind_mips32_linux_a-syswrap-linux.Po make[3]: Leaving directory '/home/mcermak/valgrind/coregrind' make[2]: *** [Makefile:2620: all] Error 2 make[2]: Leaving directory '/home/mcermak/valgrind/coregrind' make[1]: *** [Makefile:932: all-recursive] Error 1 make[1]: Leaving directory '/home/mcermak/valgrind' make: *** [Makefile:795: all] Error 2 mcermak@cfarm230:~/valgrind$
OK, so the fix is for mips32. Adjusted bug title and commit message: commit 05aa735a5b5bf4312538b440dbc0dd9568358a7d Author: Martin Cermak <mcermak@redhat.com> Date: Fri Aug 8 22:31:42 2025 +0200 Fix mips32 FTBFS Define __NR_statmount and __NR_listmount. This update makes the source buildable on the mips32 arch. https://bugs.kde.org/show_bug.cgi?id=508027