This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Further bfd robustification
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 16 Jun 2005 11:58:14 +0200
- Subject: Re: [PATCH] Further bfd robustification
- References: <20050614131346.GK7663@sunsite.mff.cuni.cz> <42B14968.4060104@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jun 16, 2005 at 10:42:00AM +0100, Nick Clifton wrote:
> Just one small issue:
>
> > case SHT_GNU_versym:
> >+ if (hdr->sh_entsize != 2)
> >+ return FALSE;
Ok, how about sizeof (Elf_External_Versym) in that case?
> >@@ -2057,6 +2065,8 @@ bfd_section_from_shdr (bfd *abfd, unsign
> > /* We need a BFD section for objcopy and relocatable linking,
> > and it's handy to have the signature available as the section
> > name. */
> >+ if (hdr->sh_entsize != 4)
> >+ return FALSE;
>
> I really think that these magic values ought to be defined macro
> constants declared in a header file somewhere (include/elf/common.h ?).
4 is used in many places for size of SHT_GROUP entries, in elf.c and
elsewhere. The ELF standard mandates that sh_entsize is 4 for that section.
But if you don't like numbers, we could perhaps add
Elf_External_Groupidx or something like that to include/elf/external.h
and use sizeof (Elf_External_Groupidx) there.
Jakub