All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] general question about patchelf and RPATH
@ 2019-09-30 16:16 Yann Sionneau
  2019-10-01 12:26 ` [Buildroot] [PATCH] Do not remove path from RPATH when it is needed for dlopen at runtime Yann Sionneau
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yann Sionneau @ 2019-09-30 16:16 UTC (permalink / raw)
  To: buildroot

Hello,

I can see that patchelf does the following:

https://github.com/buildroot/buildroot/blob/master/package/patchelf/0003-Add-option-to-make-the-rpath-relative-under-a-specif.patch#L254

What happens then if the application needs to load a shared object via 
dlopen() (so not in DT_NEEDED) which is in a directory pointed to by 
RPATH like "$ORIGIN/testlib" like the tst-origin unit test of 
uclibc-ng-test does:

https://github.com/wbx-github/uclibc-ng-test/blob/master/test/dlopen/Makefile.in#L25

https://github.com/wbx-github/uclibc-ng-test/blob/master/test/dlopen/tst-origin.c#L15

I can see at least in my build that the RPATH gets stripped from the 
final ELF in the target dir.

see:

[ysionneau at junon build_dev_k1c]$ 
./host/bin/k1-buildroot-linux-uclibc-readelf -aW 
/work1/ysionneau/runpath/workspace/build_buildroot/build_dev_k1c/target/usr/lib/uclibc-ng-test/test/dlopen/tst-origin 
| grep RPATH
 ?0x000000000000000f (RPATH)????????????? Library rpath: [$ORIGIN/testlib]
[ysionneau at junon build_dev_k1c]$ 
/work1/ysionneau/runpath/workspace/build_buildroot/build_dev_k1c/host/bin/patchelf 
--make-rpath-relative 
/work1/ysionneau/runpath/workspace/build_buildroot/build_dev_k1c/target 
--no-standard-lib-dirs 
/work1/ysionneau/runpath/workspace/build_buildroot/build_dev_k1c/target/usr/lib/uclibc-ng-test/test/dlopen/tst-origin
[ysionneau at junon build_dev_k1c]$ 
./host/bin/k1-buildroot-linux-uclibc-readelf -aW 
/work1/ysionneau/runpath/workspace/build_buildroot/build_dev_k1c/target/usr/lib/uclibc-ng-test/test/dlopen/tst-origin 
| grep RPATH
[ysionneau at junon build_dev_k1c]$ 
./host/bin/k1-buildroot-linux-uclibc-readelf -aW 
/work1/ysionneau/runpath/workspace/build_buildroot/build_dev_k1c/target/usr/lib/uclibc-ng-test/test/dlopen/tst-origin 
| grep RUNPATH
 ?0x000000000000001d (RUNPATH)??????????? Library runpath: []

To be more precise, the RPATH is replaced by RUNPATH, but the RUNPATH is 
empty.

Then the unit test fails at runtime for me.

Thanks

-- 

Yann

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-28 17:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-30 16:16 [Buildroot] general question about patchelf and RPATH Yann Sionneau
2019-10-01 12:26 ` [Buildroot] [PATCH] Do not remove path from RPATH when it is needed for dlopen at runtime Yann Sionneau
2019-10-01 12:31 ` Yann Sionneau
2019-10-01 12:33   ` Yann Sionneau
2019-10-01 12:33 ` Yann Sionneau
2019-10-23 12:06   ` Yann Sionneau
2020-08-25 12:15   ` Thomas Petazzoni
2020-08-28 17:23     ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.