_bfd_elf_init_private_section_data setting output section type improperly for .stabstr

Ian Lance Taylor iant@google.com
Fri May 12 02:14:00 GMT 2006


"H. J. Lu" <hjl@lucon.org> writes:

> --- bfd/elf.c.stabs	2006-05-11 08:52:56.000000000 -0700
> +++ bfd/elf.c	2006-05-11 09:26:36.000000000 -0700
> @@ -5911,8 +5911,7 @@ _bfd_elf_init_private_section_data (bfd 
>       output BFD section flags has been set to something different.
>       elf_fake_sections will set ELF section type based on BFD
>       section flags.  */
> -  if (osec->flags == isec->flags
> -      || (osec->flags == 0 && elf_section_type (osec) == SHT_NULL))
> +  if (osec->flags == isec->flags || !osec->flags)
>      elf_section_type (osec) = elf_section_type (isec);

This code does not make sense to me.  It assumes that a zero in the
flags field means that the section flags have not been initialized.
Why is that correct?

And, you seem to have ignored Nick's comments about this code here:
    http://sourceware.org/ml/binutils/2006-04/msg00330.html

I think it is reasonable to want to make --set-section-flags work for
ELF.  But I think that to do that we need to clearly separate the
value that the flags hold from whether the flags hold any value at
all.  Your patch seems to me to be quite fragile, and I'm not
surprised that something broke.

Ian



More information about the Binutils mailing list