Bug#660813: ld.gold doesn't take LD_RUN_PATH into account

2013-07-23 Thread Vincent Lefevre
Control: reassign -1 binutils
Control: found -1 2.22-5
Control: found -1 2.23.52.20130722-1
Control: severity -1 normal
Control: tags -1 patch

The bug has always been present in binutils (the binary package), but
its effect was visible particularly when binutils-gold was installed.
Now binutils-gold is no longer built. The problem still exists, e.g.
when providing -fuse-ld=gold, but no longer due to an effect of some
package being installed. Thus I'm downgrading the severity to normal;
the ld.bfd(1) man page documents LD_RUN_PATH, but not the ld.gold(1)
one, so that it could be seen as a wishlist, but if /usr/bin/ld can
point to ld.gold, this will break some user-side builds (with no good
workaround as -fuse-ld=bfd is not portable).

I could reproduce the problem when configuring MPFR on my machine
with:

  ./configure --with-gmp=/usr/local/gmp-debug CFLAGS='-fuse-ld=gold'

(/usr/local/gmp-debug being a version different from the /usr one).
I got:

checking if gmp.h version and libgmp version are the same... (5.0.1/5.1.2) no
configure: WARNING: ==
configure: WARNING: 'gmp.h' and 'libgmp' seem to have different versions or
configure: WARNING: we cannot run a program linked with GMP (if you cannot
configure: WARNING: see the version numbers above). A cause may be different
configure: WARNING: GMP versions with different ABI's or the use of --with-gmp
configure: WARNING: or --with-gmp-include with a system include directory
configure: WARNING: (such as /usr/include or /usr/local/include).
configure: WARNING: However since we can't use 'libtool' inside the configure,
configure: WARNING: we can't be sure. See 'config.log' for details.
configure: WARNING: CC=gcc
configure: WARNING: CFLAGS=-fuse-ld=gold
configure: WARNING: CPPFLAGS= -I/usr/local/gmp-debug/include
configure: WARNING: LDFLAGS= -L/usr/local/gmp-debug/lib
configure: WARNING: LIBS=-lgmp 
configure: WARNING: Temporary LD_RUN_PATH was /usr/local/gmp-debug/lib.
configure: WARNING: ==

The patch from

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660813#10

still works:

checking if gmp.h version and libgmp version are the same... (5.0.1/5.0.1) yes

(with the same configure line).

-- 
Vincent Lefèvre vinc...@vinc17.net - Web: http://www.vinc17.net/
100% accessible validated (X)HTML - Blog: http://www.vinc17.net/blog/
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#660813: ld.gold doesn't take LD_RUN_PATH into account

2012-02-27 Thread Vincent Lefevre
tags 660813 upstream
forwarded 660813 http://sourceware.org/bugzilla/show_bug.cgi?id=13764
thanks

Hi Jonathan,

On 2012-02-22 04:29:53 -0600, Jonathan Nieder wrote:
 How about this patch (untested)?

Thanks, this solves the problem.

 If it looks reasonable and works ok, please feel free to file this at
 http://sourceware.org/bugzilla/ or send the patch with whatever tweaks
 seem appropriate to binut...@sourceware.org[*] with [PATCH RFC] in the
 subject, cc-ing me.
 
 If you want to make people extra happy, a testcase for gold/testsuite/
 would be nice.

Unfortunately I don't know how to do this for this particular case
(there isn't a -rpath test alone to take it as an example...).

There's also the man page to update. I've given some information in
my upstream bug report.

-- 
Vincent Lefèvre vinc...@vinc17.net - Web: http://www.vinc17.net/
100% accessible validated (X)HTML - Blog: http://www.vinc17.net/blog/
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#660813: ld.gold doesn't take LD_RUN_PATH into account

2012-02-22 Thread Jonathan Nieder
Hi Vincent,

Vincent Lefevre wrote:

 Unlike the standard ld, ld.gold doesn't take LD_RUN_PATH into account.
 In particular, this breaks the build of some programs (like GNU MPFR)
 when LD_RUN_PATH is used together with autoconf's AC_RUN_IFELSE.

How about this patch (untested)?

If it looks reasonable and works ok, please feel free to file this at
http://sourceware.org/bugzilla/ or send the patch with whatever tweaks
seem appropriate to binut...@sourceware.org[*] with [PATCH RFC] in the
subject, cc-ing me.

If you want to make people extra happy, a testcase for gold/testsuite/
would be nice.

Hope that helps,
Jonathan

[*] archive: http://sourceware.org/ml/binutils

 gold/options.cc |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git i/gold/options.cc w/gold/options.cc
index fe9a00e0..e898de53 100644
--- i/gold/options.cc
+++ w/gold/options.cc
@@ -1095,6 +1095,30 @@ General_options::finalize()
   if (this-nmagic() || this-omagic())
 this-set_static(true);
 
+  // LD_RUN_PATH determines the default for -rpath.
+  if (this-rpath().empty())
+{
+  const char* rpath_env = getenv(LD_RUN_PATH);
+  if (!rpath_env)
+rpath_env = ;
+  std::string s(rpath_env);
+
+  for (size_t pos = 0, sep = s.find(':');
+   ;
+   pos = sep + 1, sep = s.find(':', pos))
+{
+  if (sep == pos)
+continue;
+
+  if (sep != std::string::npos)
+s[sep] = '\0';
+  this-add_to_rpath(s.c_str() + pos);
+
+  if (sep == std::string::npos)
+break;
+}
+}
+
   // If --thread_count is specified, it applies to
   // --thread-count-{initial,middle,final}, though it doesn't override
   // them.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org