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: PATCH: PR binutils/3826: elf_object_p can't tell freebsd object file from standard ELF object file


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


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