Bug 502566

Summary: valgrind defaults to unstripped ld-linux-x86-64.so
Product: [Developer tools] valgrind Reporter: 96wvn6bz
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: wishlist CC: pjfloyd, sam
Priority: NOR    
Version First Reported In: 3.24.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description 96wvn6bz 2025-04-08 14:22:33 UTC
SUMMARY
valgrind default to /usr/lib/ld-linux-x86-64.so.2, which on my system is stripped. I have glibc-debug installed, which installs the unstripped version to /usr/lib/debug/usr/lib/, however valgrind does not use this. Using LD_LIBRARY_PATH=/usr/lib/debug/usr/lib/ valgrind, does not fix the problem. debuginfod is installed and running.

Output:
==30428== Memcheck, a memory error detector
==30428== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==30428== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==30428== Command: ./main
==30428== 

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:  
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strcmp
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:  
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:  
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:  
valgrind:  Note that if you are debugging a 32 bit process on a
valgrind:  64 bit system, you will need a corresponding 32 bit debuginfo
valgrind:  package (e.g. libc6-dbg:i386).
valgrind:  
valgrind:  Cannot continue -- exiting now.  Sorry.

Due to the output saying to message the maintainer and tell them to next time ship and unstripped version, I have made the severity a wishlist.

STEPS TO REPRODUCE
1. Have a stripped version of glibc
2. Installed a non-stripped version of glibc
3. Rename /usr/lib/debug/usr/lib/ld-linux-x86-64.so.2.debug to usr/lib/debug/usr/lib/ld-linux-x86-64.so.2
4. Run valgrind with LD_LIBRARY_PATH pointing to the non-stripped version.

OBSERVED RESULT
(see above)

EXPECTED RESULT
I hoped that LD_LIBRARY_PATH would override which version valgrind uses, or that valgrind would find the /usr/lib/debug folder present and utilise the files in there.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Artix Linux
Comment 1 Paul Floyd 2025-08-19 06:15:58 UTC
(In reply to 96wvn6bz from comment #0)
> SUMMARY
> valgrind default to /usr/lib/ld-linux-x86-64.so.2, which on my system is
> stripped. I have glibc-debug installed, which installs the unstripped
> version to /usr/lib/debug/usr/lib/, however valgrind does not use this.
> Using LD_LIBRARY_PATH=/usr/lib/debug/usr/lib/ valgrind, does not fix the
> problem. debuginfod is installed and running.

Is the file in /usr/lib/debug/usr/lib/ really a full shared library file with debuginfo? On most systems .debug files are ELF files with just debuginfo (produced with strip). If it is just debuginfo then 'flle' will report "no program header".
Comment 2 Paul Floyd 2025-10-03 12:51:00 UTC
Didn't get an answer, and I think that this is a duplicate.

*** This bug has been marked as a duplicate of bug 286864 ***