1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-07-08 12:59:17 -04:00
ports/devel/valgrind/files/patch-coregrind-vg_preloaded.c
Paul Floyd 3d864ab972 devel/valgrind: patch for ifuncs
The work for simd support uses @gnu_indirect_function. When Valgrind sees
binaries using such function it expects to have its own ifunc_handler. Until now
there wasn't one for FreeBSD so Valgrind terminates with an abort.

This patch merges the fix maintainer and creator made upstream.

PR:		273955
Reported by:	pjfloyd@wanadoo.fr (maintainer)
2023-09-20 13:42:11 +02:00

31 lines
775 B
C

--- coregrind/vg_preloaded.c.orig 2023-09-19 20:30:09.413386000 +0200
+++ coregrind/vg_preloaded.c 2023-09-19 20:32:14.366333000 +0200
@@ -228,7 +228,27 @@
#elif defined(VGO_freebsd)
-// nothing specific currently
+#if (FREEBSD_VERS >= FREEBSD_14)
+
+void * VG_NOTIFY_ON_LOAD(ifunc_wrapper) (void);
+void * VG_NOTIFY_ON_LOAD(ifunc_wrapper) (void)
+{
+ OrigFn fn;
+ Addr result = 0;
+ Addr fnentry;
+
+ /* Call the original indirect function and get it's result */
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_v(result, fn);
+
+ fnentry = result;
+
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__ADD_IFUNC_TARGET,
+ fn.nraddr, fnentry, 0, 0, 0);
+ return (void*)result;
+}
+
+#endif
#elif defined(VGO_solaris)