bfd_arch_get_compatible
H.J. Lu
hjl.tools@gmail.com
Sat Jun 4 17:20:00 GMT 2011
On Fri, Jun 3, 2011 at 9:03 PM, Alan Modra <amodra@gmail.com> wrote:
> Some time ago --accept-unknown-input-format was added to ld,
> http://sourceware.org/ml/binutils/2002-12/msg00517.html but the patch
> committed differed from the posted patch, and had an error. As far as
> I can tell the error would never be noticed, since the return value of
> bfd_arch_get_compatible is only tested for non-NULL, except in one
> place. That place, elf32_m68k_merge_private_bfd_data, doesn't allow
> binary or unknown architectures, so the buggy return value doesn't
> matter there either. Fixed by the following archures.c patch.
>
> Incidentally, the reason I happened to be looking at this code is
> because --accept-unknown-input-format has quite weird behaviour. For
> example, suppose you build a powerpc-linux ld just using the default
> configure options, then --accept-unknown-input-format lets you link in
> i686-linux object files. However, if you build powerpc-linux ld with
> --enable-targets=all, then you can't link in i686-linux objects. So
> --enable-targets=all in this case gives you *less* functionality.
>
> In fact, you can't even do it by forcing the generic ELF target for
> the x86 objects with -b, hence the elfcode.h patch.
>
> * archures.c (bfd_arch_get_compatible): If one arch is unknown,
> return the other arch.
> * elfcode.h (elf_object_p): Allow explicit match to generic ELF
> target.
>
This caused:
http://sourceware.org/bugzilla/show_bug.cgi?id=12842
--
H.J.
More information about the Binutils
mailing list