public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@redhat.com>
To: binutils@sources.redhat.com
Subject: RFA: Small fix to elf-eh-frame.c for MIPS ELF64
Date: Sat, 13 Nov 2004 12:02:00 -0000	[thread overview]
Message-ID: <877joqkle1.fsf@redhat.com> (raw)

_bfd_elf_discard_section_eh_frame has the following code to handle
the personality data:

		      ENSURE_NO_RELOCS (buf);
		      /* Ensure we have a reloc here, against
			 a global symbol.  */
		      if (GET_RELOC (buf) != NULL)
			{
                          ...
			  cookie->rel++;
			}

This causes problems on MIPS because ELF64 composite relocations are
represented as a sequence of normal relocations against the same address.
There might be more than one relocation to skip here.

One fix would be to replace:

   cookie->rel++;

with:

   SKIP_RELOCS (buf + 1);

This is safe because of the ENSURE_NO_RELOCS() line quoted above,
and I'd be happy to write it like that if preferred.  I thought the
attached patch was slightly more readable and self-contained though.

The testcase is in the main patch that I'm about to post (which also
mentions the testing procedure).  I've split this bit out because it
wasn't really related to the rest.  OK to install?

Richard


bfd/
	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Deal with
	composite relocations against the personality data.

--- bfd/elf-eh-frame.c.orig	Fri Oct  8 13:40:53 2004
+++ bfd/elf-eh-frame.c	Sat Nov 13 09:41:56 2004
@@ -499,7 +499,10 @@ _bfd_elf_discard_section_eh_frame
 
 			      cie.personality = h;
 			    }
-			  cookie->rel++;
+			  /* Cope with MIPS-style composite relocations.  */
+			  do
+			    cookie->rel++;
+			  while (GET_RELOC (buf) != NULL);
 			}
 		      buf += per_width;
 		    }

             reply	other threads:[~2004-11-13 12:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-13 12:02 Richard Sandiford [this message]
2004-11-15  0:36 ` 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=877joqkle1.fsf@redhat.com \
    --to=rsandifo@redhat.com \
    --cc=binutils@sources.redhat.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).