This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RFA: Small fix to elf-eh-frame.c for MIPS ELF64
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Sat, 13 Nov 2004 12:01:58 +0000
- Subject: RFA: Small fix to elf-eh-frame.c for MIPS ELF64
_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;
}