Summary: | drd: dont need to intercept duplicate libc definitions if run with musl | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Stacy <stacy.gaikovaia> |
Component: | drd | Assignee: | Stacy <stacy.gaikovaia> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bart.vanassche+kde |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Stacy
2020-10-20 20:44:52 UTC
Does the following patch help? diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index 62c466f508ad..585aafe22e41 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -174,6 +174,13 @@ static int never_true; ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl \ { return implf argl; } #else +#ifdef MUSL_LIBC +/* musl provides a single library that includes pthreads functions. */ +#define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl) \ + ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl; \ + ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl \ + { return implf argl; } +#else /* * On Linux, intercept both the libc and the libpthread functions. At * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread @@ -188,6 +195,7 @@ static int never_true; ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl \ { return implf argl; } #endif +#endif /** * Macro for generating three Valgrind interception functions: one with the (In reply to Bart Van Assche from comment #1) > Does the following patch help? > > > diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c > index 62c466f508ad..585aafe22e41 100644 > --- a/drd/drd_pthread_intercepts.c > +++ b/drd/drd_pthread_intercepts.c > @@ -174,6 +174,13 @@ static int never_true; > ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl \ > { return implf argl; } > #else > +#ifdef MUSL_LIBC > +/* musl provides a single library that includes pthreads functions. */ > +#define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl) \ > + ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl; \ > + ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl \ > + { return implf argl; } > +#else > /* > * On Linux, intercept both the libc and the libpthread functions. At > * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread > @@ -188,6 +195,7 @@ static int never_true; > ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl \ > { return implf argl; } > #endif > +#endif > > /** > * Macro for generating three Valgrind interception functions: one with the Yes it does; thank you. Thanks for confirming! |