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
On Fri, Jan 05, 2007 at 01:59:46PM +1030, Alan Modra wrote:
> On Thu, Jan 04, 2007 at 11:47:50AM -0800, H. J. Lu wrote:
> > --- bfd/elf64-hppa.c.osabi 2006-10-17 06:41:47.000000000 -0700
> > +++ bfd/elf64-hppa.c 2007-01-04 11:30:52.000000000 -0800
> > @@ -1198,16 +1198,9 @@ elf64_hppa_post_process_headers (abfd, l
> > Elf_Internal_Ehdr * i_ehdrp;
> >
> > i_ehdrp = elf_elfheader (abfd);
> > -
> > - if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0)
> > - {
> > - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
> > - }
> > - else
> > - {
> > - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
> > - i_ehdrp->e_ident[EI_ABIVERSION] = 1;
> > - }
> > +
> > + i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
> > + i_ehdrp->e_ident[EI_ABIVERSION] = 1;
> > }
>
> You bumped ABIVERSION here for Linux. I'm also a little worried that
elf64_hppa_post_process_headers is no longer called for Linux/hppa.
There are
#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM bfd_elf64_hppa_linux_vec
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf64-hppa-linux"
#undef ELF_OSABI
#define ELF_OSABI ELFOSABI_LINUX
#undef elf_backend_post_process_headers
#define elf_backend_post_process_headers _bfd_elf_set_osabi
> object files created other than by binutils might use OSABI values
> other than the value we now require. For example, see the comment
That is enirely reasonable to reject such object file since it may
contain info we don't know how to handle properly. If we can handle
it, we can always define elf_backend_object_p like what elf32-hppa.c
does.
> in elf32_hppa_object_p.
That is fine since I didn't change elf_backend_object_p in
elf32-hppa.c.
H.J.