This is the mail archive of the binutils@sources.redhat.com 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] Further bfd robustification


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


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