public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Subject: Re: bfd_arch_get_compatible
Date: Mon, 06 Jun 2011 02:24:00 -0000	[thread overview]
Message-ID: <BANLkTinw=kS_ptGB1MB+YBJBpX_nDGdWhQ@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikcX9=m2HoXYzYUuWqxaBLXvRTyDQ@mail.gmail.com>

On Sun, Jun 5, 2011 at 7:13 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Jun 5, 2011 at 6:25 PM, Alan Modra <amodra@gmail.com> wrote:
>> On Sat, Jun 04, 2011 at 10:59:50AM -0700, H.J. Lu wrote:
>>> elf_object_p change caused:
>>>
>>> http://sourceware.org/bugzilla/show_bug.cgi?id=12842
>>
>> It was more the case that my change exposed other bugs, but, yes the
>> patch was half-baked and insufficiently tested.  I did test
>> i686-linux, i586-aout, i686-pe and powerpc-linux and saw no problem.
>>
>>> Do you have a testcase to show the bug you tried to fix?
>>
>> Yes, -b is ignored when selecting EM_NONE (and in some cases
>> ELFOSABI_NONE) targets.  eg.
>>
>> $ objdump -b elf32-little gas/as.o -h
>>
>> gas/as.o:     file format elf32-i386
>>                          ^^^^^^^^^^
>> Forcing a generic target isn't something you would usually want to do,
>> but I found a use in combination with --accept-unknown-input-arch.
>>
>> The underlying problem is that elf_object_p rejects the generic
>> targets when BFD is compiled with support for a more specific target,
>> in order to not match multiple targets in bfd_check_format_matches,
>> which then returns an error.  This is course was just a hack.  What we
>> should have done is taught bfd_check_format_matches that multiple
>> matches are OK when the matches in question are generic ELF and more
>> specific ELF targets.  I could have done that without adding another
>> field to bfd_target, but that would require treating ELF targets
>> specially in bfd_check_format_matches, as much of a hack as the
>> elf_object_p hack.
>>
>>        * targets.c (bfd_target): Make ar_max_namelen an unsigned char.
>>        Add match_priority.
>>        * configure.in: Bump bfd version.
>>        * elfcode.h (elf_object_p): Delete hacks preventing match of
>>        EM_NONE and ELFOSABI_NONE targets when a better match exists.
>
> Will the ELFOSABI_NONE change may break actual usages,
> like linking ELFOSABI_FREEBSD with ELFOSABI_NONE
> to generate ELFOSABI_NONE and vice verse?
>

It is

http://sources.redhat.com/bugzilla/show_bug.cgi?id=4424
http://sources.redhat.com/bugzilla/show_bug.cgi?id=5179


-- 
H.J.

  reply	other threads:[~2011-06-06  2:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04  4:04 bfd_arch_get_compatible Alan Modra
2011-06-04 12:16 ` Regressions with "bfd_arch_get_compatible" Hans-Peter Nilsson
2011-06-04 18:18   ` H.J. Lu
2011-06-05  0:08     ` Hans-Peter Nilsson
2011-06-04 17:20 ` bfd_arch_get_compatible H.J. Lu
2011-06-04 18:00   ` bfd_arch_get_compatible H.J. Lu
2011-06-06  1:26     ` bfd_arch_get_compatible Alan Modra
2011-06-06  2:13       ` bfd_arch_get_compatible H.J. Lu
2011-06-06  2:24         ` H.J. Lu [this message]
2011-06-06  2:39         ` bfd_arch_get_compatible Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTinw=kS_ptGB1MB+YBJBpX_nDGdWhQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).