[PATCH] Further bfd robustification
Jakub Jelinek
jakub@redhat.com
Thu Jun 16 09:58:00 GMT 2005
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
More information about the Binutils
mailing list