Bug 89637 - Valgrind can't find .so via embedded rpath with $ORIGIN
Summary: Valgrind can't find .so via embedded rpath with $ORIGIN
Status: RESOLVED DUPLICATE of bug 86921
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 2.2.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-16 17:07 UTC by Frank Wallingford
Modified: 2004-09-25 12:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Wallingford 2004-09-16 17:07:07 UTC
Starting with (I think) valgrind 2.1.2, valgrind no longer finds shared
libraries via the rpath embedded in the executable if it contains a reference to
$ORIGIN. Valgrind 2.0 worked, and I've also tested 2.2.0, which does not work.

If the embedded path is absolute (does not use $ORIGIN), it works fine.

Example:

shared.c:
  int foo() { return 42; }

test.c:
  extern int foo();
  int main() { return foo(); }

$ cd /tmp
$ gcc -shared shared.c -o libshared.so
$ gcc test.c -o test -L. -lshared -Wl,-rpath,'$ORIGIN'
$ cd ~
$ ldd /tmp/test
$ /tmp/test
$ valgrind --tool=memcheck /tmp/test

My system:

$ uname -a
Linux topgun 2.6.8-1-mts #8 Mon Aug 16 15:42:31 EDT 2004 i686 Pentium III
(Coppermine) unknown GNU/Linux

$ valgrind --version
valgrind-2.2.0

$ gcc --version
gcc (GCC) 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)
Comment 1 Tom Hughes 2004-09-25 12:18:34 UTC
This happens because glibc does a readlink on /proc/self/exe in order to resolve $ORIGIN for an executable and as we know from bug 86921 that doesn't work under valgrind.

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