This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: DT_RPATH from dependent lib ignored by ld?
I just figured out more about what is going on. It looks like ld is
actually looking at the DT_RPATH for my shared library, but it is not
interpreting the $ORIGIN special path. If I set the rpath to be an
absolute path then ld finds the needed library, and everything is fine. If
I use $ORIGIN in the rpath then it doesn't find the needed library, and I
get a warning and missing symbols.
To me this means that ld does not think it's a cross compiler (it's using
rpath), but is not searching in the same way that the runtime loader
searches. I'm not sure this is a bug so much as a deficiency. It would be
nice if a native linker could actually use the dynamic loader to resolve
the location of dependencies, but that may be harder than just duplicating
the logic for ORIGIN.
--
Adam Kemp
adam.kemp@ni.com
(512) 683-6058
From: Adam Kemp <adam.kemp@ni.com>
To: binutils@sourceware.org
Date: 01/20/2011 11:59 AM
Subject: Re: DT_RPATH from dependent lib ignored by ld?
Sent by: binutils-owner@sourceware.org
Sorry, I accidentally sent this just to Alan earlier. Alan, I don't know
how binutils was configured when it was built. I didn't build it. Is there
a command line option to extract that? What information are you wanting
from it?
Thanks for responding. I've reproduced this with both my own build of
binutils 2.17.50.0.17.20070615 and with the version of ld which comes with
Ubuntu 10.04 (2.20.1-system.20100303). On the custom build we're using an
i386 native build of ld and building for an i386 target (not a
cross-compile). The Ubuntu version is a 64-bit build of ld, and I have
tested both targeting 64-bit and cross-targeting 32-bit. I don't think
this is caused by a cross-compile unless it thinks we're doing a
cross-compile even when we're not.
akemp@yip:~/test/temp$ file
/mnt/Development/shared/dependencies/perforce/sa/ss/toolchain/gcc-linux-4.2.1/export/1.0/1.0.0a1/tools/linux/i386/usr/bin/i586-pc-linux-gnu-ld
/mnt/Development/shared/dependencies/perforce/sa/ss/toolchain/gcc-linux-4.2.1/export/1.0/1.0.0a1/tools/linux/i386/usr/bin/i586-pc-linux-gnu-ld:
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically
linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
akemp@yip:~/test/temp$
/mnt/Development/shared/dependencies/perforce/sa/ss/toolchain/gcc-linux-4.2.1/export/1.0/1.0.0a1/tools/linux/i386/usr/bin/i586-pc-linux-gnu-ld
-V
GNU ld (Linux/GNU Binutils) 2.17.50.0.17.20070615
Supported emulations:
elf_i386
i386linux
akemp@yip:~/test/temp$ file /usr/bin/ld.bfd
/usr/bin/ld.bfd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
akemp@yip:~/test/temp$ /usr/bin/ld.bfd -V
GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303
Supported emulations:
elf_x86_64
elf_i386
i386linux
elf_l1om
Any other ideas? One thing that would be really helpful is if there was a
way to get ld to dump where it's searching for a given library (not just
the static paths that you give it on the command line).
--
Adam Kemp
adam.kemp@ni.com
(512) 683-6058
From: Alan Modra <amodra@gmail.com>
To: Adam Kemp <adam.kemp@ni.com>
Cc: binutils@sourceware.org
Date: 01/19/2011 05:55 PM
Subject: Re: DT_RPATH from dependent lib ignored by ld?
Sent by: binutils-owner@sourceware.org
On Wed, Jan 19, 2011 at 03:25:26PM -0600, Adam Kemp wrote:
> Or can someone explain to me what I'm doing wrong?
Possibly you are not building a native linker. How did you configure?
--
Alan Modra
Australia Development Lab, IBM