Question about an elf.c change
Alan Modra
amodra@bigpond.net.au
Wed Jan 16 17:08:00 GMT 2002
On Wed, Jan 16, 2002 at 11:03:43AM -0800, Steve Ellcey wrote:
>
> 2002-01-16 Steve Ellcey <sje@cup.hp.com>
>
> * elf.c (_bfd_elf_section_from_bfd_section): Do platform
> specific section checks before generic ones.
>
> --- elf.c.orig Wed Jan 16 10:42:17 2002
> +++ elf.c Wed Jan 16 10:45:35 2002
> @@ -4044,13 +4044,6 @@ _bfd_elf_section_from_bfd_section (abfd,
> && elf_section_data (asect)->this_idx != 0)
> return elf_section_data (asect)->this_idx;
>
> - if (bfd_is_abs_section (asect))
> - return SHN_ABS;
> - if (bfd_is_com_section (asect))
> - return SHN_COMMON;
> - if (bfd_is_und_section (asect))
> - return SHN_UNDEF;
> -
> for (index = 1; index < maxindex; index++)
> {
> hdr = i_shdrp[index];
> @@ -4074,6 +4067,13 @@ _bfd_elf_section_from_bfd_section (abfd,
> return retval;
> }
> }
> +
> + if (bfd_is_abs_section (asect))
> + return SHN_ABS;
> + if (bfd_is_com_section (asect))
> + return SHN_COMMON;
> + if (bfd_is_und_section (asect))
> + return SHN_UNDEF;
>
> bfd_set_error (bfd_error_nonrepresentable_section);
This is OK. The reason I moved the bfd_is_*_section tests was for
efficiency, in order to avoid scanning sections when possible.
Hmm, now that I look at it again, I see no reason why
bed->elf_backend_section_from_bfd_section is called from inside a
loop. None of the backends use the hdr arg. I might make a
slightly more comprehensive patch.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list