This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR binutils/3826: elf_object_p can't tell freebsd object file from standard ELF object file
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 13 Mar 2007 16:18:19 +0100
- Subject: Re: PATCH: PR binutils/3826: elf_object_p can't tell freebsd object file from standard ELF object file
- References: <20070104153132.GA24896@lucon.org> <20070104194750.GA30044@lucon.org> <20070105032945.GD12887@bubble.grove.modra.org> <20070105035443.GA32376@lucon.org> <20070105043825.GF12887@bubble.grove.modra.org> <20070105051240.GA4227@lucon.org> <20070313110115.GG1826@sunsite.mff.cuni.cz> <20070313150355.GA8534@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Mar 13, 2007 at 08:03:55AM -0700, H. J. Lu wrote:
> How about this? We treat ELFOSABI_NONE ELF target like generic ELF
> target and match it with any ELF target of the same machine for which
> we do not have a specific backend.
Better.
> @@ -628,6 +627,37 @@ elf_object_p (bfd *abfd)
> goto got_no_match;
> }
>
> + if (ebd->elf_machine_code != EM_NONE
> + && ebd->elf_osabi == ELFOSABI_NONE
> + && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi)
> + {
> + /* This is the ELFOSABI_NONE ELF target. Let it match any ELF
> + target of the same machine for which we do not have a specific
> + backend. */
> + for (target_ptr = bfd_target_vector;
> + *target_ptr != NULL;
> + target_ptr++)
...
> + }
> +
This is a good condition for the searching for more specific target vector.
But you don't do anything for the
ebd->elf_osabi != ELFOSABI_NONE && i_ehdrp->e_ident[EI_OSABI] != ebd->elf_osabi
case - guess in that case you should just always fail. So perhaps
remove && ebd->elf_osabi == ELFOSABI_NONE from the outer if and add
if (ebd->elf_osabi != ELFOSABI_NONE)
goto got_wrong_format_error;
as the first thing inside of the if?
Jakub