This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bfd_arch_get_compatible


On Sat, Jun 4, 2011 at 10:20 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.

elf_object_p change caused:

http://sourceware.org/bugzilla/show_bug.cgi?id=12842

Do you have a testcase to show the bug you tried to fix?
In the meantime, I will revert the elf_object_p change.

>> ? ? ? ?* 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.
>>


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]