public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Jie Zhang" <jzhang918@gmail.com>
To: "Jie Zhang" <jzhang918@gmail.com>,
	binutils@sourceware.org,  	"Alexandre Oliva" <aoliva@redhat.com>,
	 	"Bernd Schmidt" <bernds_cb1@t-online.de>
Subject: Re: [PATCH, bfin] Clear relocs for removed entries in .eh_frame section
Date: Thu, 27 Apr 2006 16:42:00 -0000	[thread overview]
Message-ID: <6f48278f0604262026q4fcb5ce3qf1fb3369a7ca8ac9@mail.gmail.com> (raw)
In-Reply-To: <20060426063229.GV27430@bubble.grove.modra.org>

On 4/26/06, Alan Modra <amodra@bigpond.net.au> wrote:
> On Wed, Apr 26, 2006 at 11:45:19AM +0800, Jie Zhang wrote:
> > 1. I saw this in elflink.c:elf_link_input_bfd ()
> >
> >                     /* This is a reloc for a deleted entry or somesuch.
> >                        Turn it into an R_*_NONE reloc, at the same
> >                        offset as the last reloc.  elf_eh_frame.c and
> >                        elf_bfd_discard_info rely on reloc offsets
> >                        being ordered.  */
> >
> > In my patch I just set the offset to zero. It seems works. I don't
> > know if we need do the same.
> >
> > Alan: The comment was from you. Can you help me understand it?
>
> bfd_elf_discard_info indirectly calls bfd_elf_reloc_symbol_deleted_p,
> which scans relocs looking for a particular offset.
>
>   for (; rcookie->rel < rcookie->relend; rcookie->rel++)
>     {
>       unsigned long r_symndx;
>
>       if (! rcookie->bad_symtab)
>         if (rcookie->rel->r_offset > offset)
>           return FALSE;
>       if (rcookie->rel->r_offset != offset)
>         continue;
>
> There are some macros in elf-eh-frame.c, ENSURE_NO_RELOCS and
> SKIP_RELOCS that similarly test r_offset.  The above code won't work in
> general if relocs are unordered.  However, I see that the way the code
> is written, setting r_offset to zero is OK.  You just need to ensure
> r_offset is not set to some larger value than r_offset in following
> relocs.
>
Thanks for explain this. Now I feel safe to set the offset of deleted
reloc to 0.

> > 2. In bfinfdpic_relocate_section () there are several calls to
> > _bfd_elf_section_offset () before calling _bfinfdpic_add_dyn_reloc ().
> > Only in one place the return value of _bfd_elf_section_offset () is
> > checked in my patch. It seems works. But I'm not sure if we need add
> > such check for all these calls.
>
> If _bfd_elf_section_offset can return -1 or -2 then you need to add the
> check.  If it cannot, eg. because the particular reloc type is not used
> in eh_frame or stabs section, then you don't need the check.  Of course,
> if you don't need the check, then you also don't need to call
> _bfd_elf_section_offset.  :-)
>
I'll review the related code in Blackfin FDPIC to see if there are
more cases need check. I also would like to hear from Alex before
doing any checkin.

> > 3. Is it possible to not emit the reloc instead of set its type to R_*_NONE?
>
> It's too late.  You have already allocated space for the dynamic relocs.
>
OK.

Thanks,
Jie

  reply	other threads:[~2006-04-27  3:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-26  9:29 Jie Zhang
2006-04-26  9:34 ` Alan Modra
2006-04-27 16:42   ` Jie Zhang [this message]
2006-05-23  9:42 ` Jie Zhang

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=6f48278f0604262026q4fcb5ce3qf1fb3369a7ca8ac9@mail.gmail.com \
    --to=jzhang918@gmail.com \
    --cc=aoliva@redhat.com \
    --cc=bernds_cb1@t-online.de \
    --cc=binutils@sourceware.org \
    /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).