https://sourceware.org/bugzilla/show_bug.cgi?id=22586
Bug ID: 22586 Summary: RPATH no longer respected for indirect dependencies Product: binutils Version: 2.29 Status: UNCONFIRMED Severity: critical Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: steve.lorimer at gmail dot com Target Milestone: --- Upgraded from ld-2.26.1 to ld-2.29.1. I am building a binary with a hard-coded RUNPATH, pointing to the location of some vendor-supplied shared libraries. $ readelf -d /home/steve/src/krx/tests/krx.test | grep RUNPATH 0x000000000000001d (RUNPATH) Library runpath: [../library] With ld-2.26.1 the RUNPATH allowed us to locate the libraries. $ ldd ./krx.test ... libinisafeNet.so => ../library/libinisafeNet.so (0x00007f35c7754000) libiniCore.so => ../library/libiniCore.so (0x00007f35c5bea000) libiniPKI.so => ../library/libiniPKI.so (0x00007f35c5952000) libiniCrypto.so => ../library/libiniCrypto.so (0x00007f35c56e6000) With ld-2.29.1 it no longer works $ ldd ./krx.test ... libinisafeNet.so => ../library/libinisafeNet.so (0x00007fb4acc38000) libiniCore.so => not found libiniPKI.so => not found libiniCrypto.so => not found Setting LD_LIBRARY_PATH does allow the libraries to be found $ export LD_LIBRARY_PATH=../library $ ldd ./krx.test ... libinisafeNet.so => ../library/libinisafeNet.so (0x00007fa787659000) libiniCore.so => ../library/libiniCore.so (0x00007fa785a86000) libiniPKI.so => ../library/libiniPKI.so (0x00007fa7857ee000) libiniCrypto.so => ../library/libiniCrypto.so (0x00007fa785582000) << LD_DEBUG >> ** ld-2.26.1; LD_DEBUG=all: Here is an excerpt for libiniCore.so: 30438: file=libiniCore.so [0]; needed by ../library/libinisafeNet.so [0] 30438: find library=libiniCore.so [0]; searching 30438: search path=../library/tls/x86_64:../library/tls:../library/x86_64:../library (RPATH from file ./krx.test) 30438: trying file=../library/tls/x86_64/libiniCore.so 30438: trying file=../library/tls/libiniCore.so 30438: trying file=../library/x86_64/libiniCore.so 30438: trying file=../library/libiniCore.so The library is successfully located, and as can be seen from the search path section, it is using RPATH from file ./krx.test. ** ld-2.29.1; LD_DEBUG=all: Here is an excerpt for libiniCore.so: (it now uses the system search path, not the krx.test RPATH) 20027: file=libiniCore.so [0]; needed by ../library/libinisafeNet.so [0] 20027: find library=libiniCore.so [0]; searching 20027: search cache=/etc/ld.so.cache 20027: search path=/lib/x86_64-linux-gnu/tls/haswell/x86_64:/lib/x86_64-linux-gnu/tls/haswell:/lib/x86_64-linux-gnu/tls/x86_64:/lib/x86_64-linux-gnu/tls:/lib/x86_64-linux-gnu/haswell/x86_64:/lib/x86_64-linux-gnu/haswell:/lib/x86_64-linux-gnu/x86_64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/tls/haswell/x86_64:/usr/lib/x86_64-linux-gnu/tls/haswell:/usr/lib/x86_64-linux-gnu/tls/x86_64:/usr/lib/x86_64-linux-gnu/tls:/usr/lib/x86_64-linux-gnu/haswell/x86_64:/usr/lib/x86_64-linux-gnu/haswell:/usr/lib/x86_64-linux-gnu/x86_64:/usr/lib/x86_64-linux-gnu:/lib/tls/haswell/x86_64:/lib/tls/haswell:/lib/tls/x86_64:/lib/tls:/lib/haswell/x86_64:/lib/haswell:/lib/x86_64:/lib:/usr/lib/tls/haswell/x86_64:/usr/lib/tls/haswell:/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/haswell/x86_64:/usr/lib/haswell:/usr/lib/x86_64:/usr/lib (system search path) 20027: trying file=/lib/x86_64-linux-gnu/tls/haswell/x86_64/libiniCore.so 20027: trying file=/lib/x86_64-linux-gnu/tls/haswell/libiniCore.so 20027: trying file=/lib/x86_64-linux-gnu/tls/x86_64/libiniCore.so 20027: trying file=/lib/x86_64-linux-gnu/tls/libiniCore.so 20027: trying file=/lib/x86_64-linux-gnu/haswell/x86_64/libiniCore.so 20027: trying file=/lib/x86_64-linux-gnu/haswell/libiniCore.so 20027: trying file=/lib/x86_64-linux-gnu/x86_64/libiniCore.so ... ... 20027: trying file=/lib/x86_64/libiniCore.so 20027: trying file=/lib/libiniCore.so 20027: trying file=/usr/lib/tls/haswell/x86_64/libiniCore.so 20027: trying file=/usr/lib/tls/haswell/libiniCore.so 20027: trying file=/usr/lib/tls/x86_64/libiniCore.so 20027: trying file=/usr/lib/tls/libiniCore.so 20027: trying file=/usr/lib/haswell/x86_64/libiniCore.so 20027: trying file=/usr/lib/haswell/libiniCore.so 20027: trying file=/usr/lib/x86_64/libiniCore.so 20027: trying file=/usr/lib/libiniCore.so So it seems the behaviour of ld has changed, and since it is an indirect dependency (krx.test --> libinisafeNet.so --> libiniCore.so) the RPATH for krx.test is no longer used. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils