This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Binutuls is broken now.
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Subject: Re: Binutuls is broken now.
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Mon, 18 Jun 2001 10:29:34 -0700
- Cc: binutils at sourceware dot cygnus dot com, nickc at cambridge dot redhat dot com
- References: <20010618101017.A27483@lucon.org> <200106181719.TAA12092@ignucius.axis.se>
On Mon, Jun 18, 2001 at 07:19:45PM +0200, Hans-Peter Nilsson wrote:
> > Date: Mon, 18 Jun 2001 10:10:17 -0700
> > From: "H . J . Lu" <hjl@lucon.org>
>
> > This patch
> >
> > http://sources.redhat.com/ml/binutils/2001-06/msg00342.html
> >
> > breaks the Linux kernel build. I got
> >
> > # ld -m elf_i386 -r -o piggy.o -b binary tmppiggy.gz -b elf32-i386 -T tmppiggy.lnk
> > ld: Relocatable linking from format binary (tmppiggy.gz) to format elf32-i386 (piggy.o) is not supported
> >
> > I will try to find a fix.
>
> Running objcopy on tmppiggy.gz to make a elf32-i386 piggy.o
> before linking it -r seems TRT.
It is not acceptable. It changed the linker behavior.
>
> Otherwise (but not TRT IMHO), it seems it would be sufficient to
> add bfd_target_binary_flavour to object format flavours (for
> some reason it's not listed as a flavour) and check for it in
> ldlang.c as an exception to cannot-link--r.
>
I am going to check in this under the obvious fix rule.
H.J.
----
2001-06-18 H.J. Lu <hjl@gnu.org>
* ldlang.c (lang_check): Allow relocatable link from the binary
format to the non-binary format.
--- ../../../import/sourceware/src/ld/ldlang.c Mon Jun 18 10:21:23 2001
+++ ./ldlang.c Mon Jun 18 10:24:26 2001
@@ -3521,7 +3521,12 @@ lang_check ()
bfd_printable_name (output_bfd));
}
else if (link_info.relocateable
- && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd))
+ && bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd)
+ && (bfd_get_flavour (input_bfd)
+ != bfd_target_unknown_flavour
+ || bfd_get_flavour (output_bfd)
+ == bfd_target_unknown_flavour
+ || strcmp (bfd_get_target (input_bfd), "binary") != 0))
einfo (_("%P%F: Relocatable linking from format %s (%B) to format %s (%B) is not supported\n"),
bfd_get_target (input_bfd), input_bfd,
bfd_get_target (output_bfd), output_bfd);