diff mbox

PATCH: Don't set HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes

Message ID CAMe9rOr5k7e+cELu-f=bSvKGAfr5g7Fk7=W9cewfhGk77Te+aA@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Aug. 25, 2012, 3:58 p.m. UTC
On Sat, Aug 25, 2012 at 8:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> Hi,
>
> Setting HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes causes:
>
> as: error while loading shared libraries:
> /builddir/build/BUILD/binutils/./opcodes/.libs/libopcodes-2.23.51.0.2-0.1.fc17.so:
> file too short
> make[4]: *** [gold-threads.o] Error 2
>
> when compiling gold using binutils linked with the same versions of libbfd
> and libopcodes. As far as I can tell, one can run the newly built binutils
> without setting them since libtool already sets up proper DT_RPATH.
>

The change was introduced by

http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01452.html

Paolo, do you remember the reason for this?

I tested this patch and works fine with --enable-shared for binutils.
I tested both separate build directory and in-source build.  OK
to install?

Thanks.

Comments

Mike Frysinger Aug. 25, 2012, 10:27 p.m. UTC | #1
On Saturday 25 August 2012 11:58:08 H.J. Lu wrote:
> On Sat, Aug 25, 2012 at 8:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > Hi,
> > 
> > Setting HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes causes:
> > 
> > as: error while loading shared libraries:
> > /builddir/build/BUILD/binutils/./opcodes/.libs/libopcodes-2.23.51.0.2-0.1
> > .fc17.so: file too short
> > make[4]: *** [gold-threads.o] Error 2
> > 
> > when compiling gold using binutils linked with the same versions of
> > libbfd and libopcodes. As far as I can tell, one can run the newly built
> > binutils without setting them since libtool already sets up proper
> > DT_RPATH.
> 
> The change was introduced by
> 
> http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01452.html
> 
> Paolo, do you remember the reason for this?
> 
> I tested this patch and works fine with --enable-shared for binutils.
> I tested both separate build directory and in-source build.  OK
> to install?

does this also fix:
http://sourceware.org/bugzilla/show_bug.cgi?id=4970
-mike
H.J. Lu Aug. 25, 2012, 10:31 p.m. UTC | #2
On Sat, Aug 25, 2012 at 3:27 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 25 August 2012 11:58:08 H.J. Lu wrote:
>> On Sat, Aug 25, 2012 at 8:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> > Hi,
>> >
>> > Setting HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes causes:
>> >
>> > as: error while loading shared libraries:
>> > /builddir/build/BUILD/binutils/./opcodes/.libs/libopcodes-2.23.51.0.2-0.1
>> > .fc17.so: file too short
>> > make[4]: *** [gold-threads.o] Error 2
>> >
>> > when compiling gold using binutils linked with the same versions of
>> > libbfd and libopcodes. As far as I can tell, one can run the newly built
>> > binutils without setting them since libtool already sets up proper
>> > DT_RPATH.
>>
>> The change was introduced by
>>
>> http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01452.html
>>
>> Paolo, do you remember the reason for this?
>>
>> I tested this patch and works fine with --enable-shared for binutils.
>> I tested both separate build directory and in-source build.  OK
>> to install?
>
> does this also fix:
> http://sourceware.org/bugzilla/show_bug.cgi?id=4970
> -mike

Yes, it should.  That is the same bug I ran into.  Please
give my patch a try.

Thanks.
Mike Frysinger Aug. 26, 2012, 2:05 a.m. UTC | #3
On Saturday 25 August 2012 18:31:32 H.J. Lu wrote:
> On Sat, Aug 25, 2012 at 3:27 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Saturday 25 August 2012 11:58:08 H.J. Lu wrote:
> >> On Sat, Aug 25, 2012 at 8:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> >> > Hi,
> >> > 
> >> > Setting HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes causes:
> >> > 
> >> > as: error while loading shared libraries:
> >> > /builddir/build/BUILD/binutils/./opcodes/.libs/libopcodes-2.23.51.0.2-
> >> > 0.1 .fc17.so: file too short
> >> > make[4]: *** [gold-threads.o] Error 2
> >> > 
> >> > when compiling gold using binutils linked with the same versions of
> >> > libbfd and libopcodes. As far as I can tell, one can run the newly
> >> > built binutils without setting them since libtool already sets up
> >> > proper DT_RPATH.
> >> 
> >> The change was introduced by
> >> 
> >> http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01452.html
> >> 
> >> Paolo, do you remember the reason for this?
> >> 
> >> I tested this patch and works fine with --enable-shared for binutils.
> >> I tested both separate build directory and in-source build.  OK
> >> to install?
> > 
> > does this also fix:
> > http://sourceware.org/bugzilla/show_bug.cgi?id=4970
> 
> Yes, it should.  That is the same bug I ran into.  Please
> give my patch a try.

yep, seems to fix the use case i described (cross-compiler with shared libs 
enabled and running the same version of binutils with shared libs on the host)
-mike
Paolo Bonzini Aug. 26, 2012, 1:22 p.m. UTC | #4
Il 25/08/2012 17:58, H.J. Lu ha scritto:
> The change was introduced by
> 
> http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01452.html
> 
> Paolo, do you remember the reason for this?

Actually, this patch came before bfd started using libtool and hence .libs.

The patch is okay if binutils always uses libtool to link programs that
require libbfd and libopcodes.  Can you check?

Paolo
H.J. Lu Aug. 26, 2012, 1:52 p.m. UTC | #5
On Sun, Aug 26, 2012 at 6:22 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> Il 25/08/2012 17:58, H.J. Lu ha scritto:
>> The change was introduced by
>>
>> http://gcc.gnu.org/ml/gcc-cvs/2005-03/msg01452.html
>>
>> Paolo, do you remember the reason for this?
>
> Actually, this patch came before bfd started using libtool and hence .libs.
>
> The patch is okay if binutils always uses libtool to link programs that
> require libbfd and libopcodes.  Can you check?
>

Yes, binutils always uses libtool. GDB doesn't use libtool. But it is linked
against libbfd.a and libopcodes.a when configured with --enable-shared.
I am checking it in.
diff mbox

Patch

diff --git a/Makefile.def b/Makefile.def
index 9e41ff5..220c720 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -32,8 +32,8 @@  build_modules= { module= m4; };
 build_modules= { module= texinfo; };
 build_modules= { module= fixincludes; };

-host_modules= { module= bfd; lib_path=.libs; bootstrap=true; };
-host_modules= { module= opcodes; lib_path=.libs; bootstrap=true; };
+host_modules= { module= bfd; bootstrap=true; };
+host_modules= { module= opcodes; bootstrap=true; };
 host_modules= { module= binutils; bootstrap=true; };
 host_modules= { module= bison; no_check_cross= true; };
 host_modules= { module= cgen; };
diff --git a/Makefile.in b/Makefile.in
index 038f801..4fc4d36 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -621,7 +621,7 @@  TARGET_LIB_PATH_libgomp =
$$r/$(TARGET_SUBDIR)/libgomp/.libs:

 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that programs built for the host machine work.
-HOST_LIB_PATH =
$(HOST_LIB_PATH_bfd)$(HOST_LIB_PATH_opcodes)$(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_ppl)$(HOST_LIB_PATH_cloog)$(HOST_LIB_PATH_libelf)
+HOST_LIB_PATH =
$(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_ppl)$(HOST_LIB_PATH_cloog)$(HOST_LIB_PATH_libelf)