[PATCH] Further bfd robustification

Nick Clifton nickc@redhat.com
Thu Jun 16 15:22:00 GMT 2005


Hi Jakub,

>>>    case SHT_GNU_versym:
>>>+      if (hdr->sh_entsize != 2)
>>>+	return FALSE;

> Ok, how about sizeof (Elf_External_Versym) in that case?

Yes please.


>>>@@ -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.

Well if the standard mandates 4 then we can just add a #define to 
external.h.  There is no need for a sizeof() unless we are dealing with 
a structure of some kind.

Cheers
   Nick




More information about the Binutils mailing list