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]

PATCH: Don't use section name to set ELF section data


On Tue, Jun 17, 2003 at 12:20:55PM +0100, Nick Clifton wrote:
> Hi H.J.
> 
> > Here is my first attempt. It passed "make check" on Linux/i386. I'd 
> > like to know if I am on the right track before I finish my work.
> 
> In general this looks good.  Why is it necessary ?
> 
> A couple of points:
> 
> > +  { ".rel",	SHT_REL,	0,				4},
> > +  { ".rela",	SHT_RELA,	0,				5},
> 
> > +      for (i = 0; special_sections[i].name != NULL; i++)
> > +	if (sec->name
> > +	    && ((special_sections[i].length
> > +		 && strncmp (sec->name, special_sections[i].name,
> > +			     special_sections[i].length) == 0)
> > +		|| strcmp (sec->name, special_sections[i].name) == 0))
> > +	  {
> 
> This looks slightly wrong to me.  The ".rel" section name will always
> match a ".rela" section since it is tested first.  Plus the code does
> not check "get_elf_backend (abfd)->may_use_rela_p".
> 
> 
> 
> > +      if (special_sections[i].name == NULL)
> > +	{
> > +	  if (strncmp (sec->name, ".stab", 5) == 0
> > +	      && strcmp (sec->name
> > +			 + strlen (sec->name) - 3, "str") == 0)
> > +	    elf_section_type (sec) = SHT_STRTAB;
> > +	}
> 
> It would be more elegant, though probably less efficient, if this test
> could be incorporated into the special_sections[] array.
> 

Here is the new patch. It caused no regressions on all targets
affected. It fixed an ELF/ppc64 bug.


H.J.

Attachment: binutils-type-2.patch
Description: Text document


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