]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin regtest: fix compilation of gdbserver_tests/self_invalidate.c
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 18 Mar 2026 06:48:39 +0000 (07:48 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 18 Mar 2026 06:48:39 +0000 (07:48 +0100)
This test checks for amd64 or mips. For amd64 it uses syscall 64.
That is 'exit' on Linux, 'umask' on both FreeBSD and Solaris
(which seems to work by accident). On Darwin it isn't a valid
syscall number which causes a Valgrind error.

Now Darwin uses syscall 0x02000001 (exit) and the test passes.

gdbserver_tests/self_invalidate.c

index 52b3d2bef18b69784efdd10459ded56926163a74..5a671e33cb37be12f6a8c3dd1d066eaaa71324a2 100644 (file)
@@ -15,7 +15,11 @@ __asm__ __volatile__
     "dec %%eax\n\t"
     "cmp    $0x0,%%eax\n\t"
     "jne top\n\t"
-    "mov $60, %%eax\n\t"
+#if defined(__APPLE__)
+    "mov $0x02000001, %%eax\n\t" /* macOS exit */
+#else
+    "mov $60, %%eax\n\t" /* Linux exit, FreeBSD and Solaris umask. umask works by accident. */
+#endif
     "mov $0, %%rdi\n\t"
     "syscall\n\t"
     : : : "eax", "ebx", "rdi"