bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/18992] Linking a library implicitly using relative DT_RPATH does


From: sourceware-bugzilla at jbeekman dot nl
Subject: [Bug ld/18992] Linking a library implicitly using relative DT_RPATH does not work
Date: Wed, 23 Sep 2015 06:30:11 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18992

--- Comment #5 from Jethro Beekman <sourceware-bugzilla at jbeekman dot nl> ---
This indeed seems to be the case. In particular, on Ubuntu 14.04, this patch is
not applied:
http://apt-browse.org/browse/debian/wheezy/main/all/binutils-source/2.22-8/file/usr/src/binutils/patches/158_ld_system_root.patch
. It is applied on all other versions of Debian/Ubuntu I have tested. On all
these OS'es, the linker is invoked with --sysroot=/ but it only has any effect
on Ubuntu 14.04, and from the strace log I can indeed see that the linker tries
to access /dir/liba.so.

I don't think the sysroot should be prepended to relative paths. Here's a patch
to fix:

diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 682f5e5..a70b138 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1282,9 +1282,12 @@ fragment <<EOF
          rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
          for (; !found && rp != NULL; rp = rp->next)
            {
-             char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
+             char *tmpname = NULL, *name;
+             if (rp->name[0] == '/')
+               tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
+                 name = tmpname ? tmpname : rp->name;
              found = (rp->by == l->by
-                      && gld${EMULATION_NAME}_search_needed (tmpname,
+                      && gld${EMULATION_NAME}_search_needed (name,
                                                              &n,
                                                              force));
              free (tmpname);

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]