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

2015-09-22 Thread jwakely.gcc at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

Jonathan Wakely  changed:

   What|Removed |Added

 CC||jwakely.gcc at gmail dot com

--- Comment #1 from Jonathan Wakely  ---
(In reply to Jethro Beekman from comment #0)
> $ gcc main.c -L. -Wl,-rpath,. -lb -o main
> /usr/bin/ld.bfd.real: warning: liba.so, needed by ./libb.so, not found (try
> using -rpath or -rpath-link)
> ./libb.so: undefined reference to `a'
> collect2: error: ld returned 1 exit status

I asked the reporter to file this bug, but I've just tried it with
binutils-2.25-9.fc22.x86_64 and don't see this warning.

-- 
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


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

2015-09-22 Thread sourceware-bugzilla at jbeekman dot nl
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

Jethro Beekman  changed:

   What|Removed |Added

 Status|NEW |UNCONFIRMED
 Ever confirmed|1   |0

--- Comment #2 from Jethro Beekman  ---
I tried this on a variety of OS'es, including various versions of Debian,
Ubuntu, RHEL and SunOS and so far I can only reproduce this on Ubuntu 14.04.

-- 
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


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

2015-09-22 Thread vapier at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

Mike Frysinger  changed:

   What|Removed |Added

 CC||vapier at gentoo dot org

--- Comment #3 from Mike Frysinger  ---
are you using gold there ?  compare `ld --version | head -1`.

-- 
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


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

2015-09-22 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

Alan Modra  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-09-23
 CC||amodra at gmail dot com
 Ever confirmed|0   |1

--- Comment #4 from Alan Modra  ---
This will be because your linker is configured with a sysroot, and is
prepending the sysroot to relative paths.  I'm guessing --with-sysroot=/

-- 
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


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

2015-09-22 Thread sourceware-bugzilla at jbeekman dot nl
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

--- Comment #5 from Jethro Beekman  ---
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 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.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


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

2015-09-23 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com

-- 
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


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

2015-09-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

--- Comment #6 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3074964fcfff45aef4584b84550eeef84f902fc4

commit 3074964fcfff45aef4584b84550eeef84f902fc4
Author: Alan Modra 
Date:   Thu Sep 24 13:13:57 2015 +0930

Relative DT_RPATH/DT_RUNPATH vs. sysroot capable ld.

This fixes two problems.  First, the --sysroot option wasn't available
with a ld configured without --with-sysroot, a historical accident.
This led to people configuring binutils with --with-sysroot=/ in order
to enable sysroot support, which exposes a case where ld wrongly
prepends the sysroot to a relative path.

PR ld/18992
* ldmain.c (main): Always enable --sysroot.
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't
prepend sysroot to relative rpath/runpath.

-- 
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


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

2016-12-29 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=18992

Alan Modra  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Alan Modra  ---
Fixed a while ago.

-- 
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