public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: Steve Ellcey <sje@cup.hp.com>
Cc: binutils@sources.redhat.com
Subject: Re: Question about an elf.c change
Date: Wed, 16 Jan 2002 17:08:00 -0000	[thread overview]
Message-ID: <20020117010340.GR21859@bubble.sa.bigpond.net.au> (raw)
In-Reply-To: <200201161903.LAA05012@hpsje.cup.hp.com>

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

  reply	other threads:[~2002-01-17  1:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-16 12:45 Steve Ellcey
2002-01-16 17:08 ` Alan Modra [this message]
2002-01-17  8:03   ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020117010340.GR21859@bubble.sa.bigpond.net.au \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    --cc=sje@cup.hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).