https://bugs.kde.org/show_bug.cgi?id=428035

            Bug ID: 428035
           Summary: drd: dont need to intercept duplicate libc definitions
                    if run with musl
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: drd
          Assignee: bvanass...@acm.org
          Reporter: stacy.gaikov...@windriver.com
  Target Milestone: ---

SUMMARY
commit #15330adf7c2471fbaa6a0818db07078d81dbff97
(https://sourceware.org/git/?p=valgrind.git;a=commit;h=15330adf7c2471fbaa6a0818db07078d81dbff97)
made it such that valgrind intercepts function definitions in both libc and
libpthread. This breaks builds compiled with musl libc, as these same function
defintions do not exist in musl.

STEPS TO REPRODUCE
1. Make sure you're on a system running musl (ldd --version)
2. attempt to compile valgrind 

OBSERVED RESULT
Compilation fails with
In file included from drd_pthread_intercepts.c:58:
../include/pub_tool_redir.h:228:15: error: redefinition of
'_vgw00000ZZ_libcZdZa_pthreadZucreate'
  228 |    VG_CONCAT6(_vgw,00000,ZZ_,_soname,_,_fnname)
      |               ^~~~
../include/pub_tool_redir.h:202:45: note: in definit
ion of macro 'VG_CONCAT6'
  202 | #define VG_CONCAT6(_aa,_bb,_cc,_dd,_ee,_ff)
_aa##_bb##_cc##_dd##_ee##_ff
      |                                             ^~~
drd_pthread_intercepts.c:188:11: note: in expansion of macro
'VG_WRAP_FUNCTION_ZZ'
  188 |    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl     
\
      |           ^~~~~~~~~~~~~~~~~~~
drd_pthread_intercepts.c:200:4: note: in expansion of macro 'PTH_FUNC'
  200 |    PTH_FUNC(ret_ty, zf, implf, argl_decl, argl);                \
      |    ^~~~~~~~
drd_pthread_intercepts.c:598:1: note: in expansion of macro 'PTH_FUNCS'
  598 | PTH_FUNCS(int, pthreadZucreate, pthread_create_intercept,
      | ^~~~~~~~~
../include/pub_tool_redir.h:228:15: note: previous definition of
'_vgw00000ZZ_libcZdZa_pthreadZucreate' was here
  228 |    VG_CONCAT6(_vgw,00000,ZZ_,_soname,_,_fnname)
      |               ^~~~
../include/pub_tool_redir.h:202:45: note: in definition of macro 'VG_CONCAT6'
  202 | #define VG_CONCAT6(_aa,_bb,_cc,_dd,_ee,_ff)
_aa##_bb##_cc##_dd##_ee##_ff
      |                                             ^~~
drd_pthread_intercepts.c:185:11: note: in expansion of macro
'VG_WRAP_FUNCTION_ZZ'
  185 |    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl           
\
      |           ^~~~~~~~~~~~~~~~~~~
drd_pthread_intercepts.c:200:4: note: in expansion of macro 'PTH_FUNC'
  200 |    PTH_FUNC(ret_ty, zf, implf, argl_decl, argl);                \
      |    ^~~~~~~~
drd_pthread_intercepts.c:598:1: note: in expansion of macro 'PTH_FUNCS'
  598 | PTH_FUNCS(int, pthreadZucreate, pthread_create_intercept,
      | ^~~~~~~~~
../include/pub_tool_redir.h:228:15: error: redefinition of
'_vgw00000ZZ_libcZdZa_pthreadZucreateZAZa'
  228 |    VG_CONCAT6(_vgw,00000,ZZ_,_soname,_,_fnname)
      |               ^~~~
../include/pub_tool_redir.h:202:45: note: in definition of macro 'VG_CONCAT6'
  202 | #define VG_CONCAT6(_aa,_bb,_cc,_dd,_ee,_ff)
_aa##_bb##_cc##_dd##_ee##_ff
      |                                             ^~~
drd_pthread_intercepts.c:188:11: note: in expansion of macro
'VG_WRAP_FUNCTION_ZZ'
  188 |    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl     
\
      |           ^~~~~~~~~~~~~~~~~~~
drd_pthread_intercepts.c:201:4: note: in expansion of macro 'PTH_FUNC'
  201 |    PTH_FUNC(ret_ty, zf ## ZAZa, implf, argl_decl, argl);        \
      |    ^~~~~~~~
etc

EXPECTED RESULT
Compile succeeds 

SOFTWARE/OS VERSIONS
Windows: -
macOS: -
Linux/KDE Plasma: poky linux
(available in About System)
KDE Plasma Version: -
KDE Frameworks Version: -
Qt Version: -

ADDITIONAL INFORMATION
I am happy to submit a patch to the project; alas I am having trouble finding
instructions on how to do so.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to