public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* RFA: Small fix to elf-eh-frame.c for MIPS ELF64
@ 2004-11-13 12:02 Richard Sandiford
  2004-11-15  0:36 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2004-11-13 12:02 UTC (permalink / raw)
  To: binutils

_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;
 		    }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFA: Small fix to elf-eh-frame.c for MIPS ELF64
  2004-11-13 12:02 RFA: Small fix to elf-eh-frame.c for MIPS ELF64 Richard Sandiford
@ 2004-11-15  0:36 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2004-11-15  0:36 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: binutils

On Sat, Nov 13, 2004 at 12:01:58PM +0000, Richard Sandiford wrote:
> 	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Deal with
> 	composite relocations against the personality data.

OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-15  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-13 12:02 RFA: Small fix to elf-eh-frame.c for MIPS ELF64 Richard Sandiford
2004-11-15  0:36 ` Alan Modra

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).