[PATCH, needs GWP] Honour int_rels_per_ext_rel when creating @plt symbols

Richard Sandiford rdsandiford@googlemail.com
Sat Jun 28 17:59:00 GMT 2008
One of the quirks of the MIPS n64 ABI is that every relocation
is a compound of three r_types.  BFD chooses to represent each
external compound relocation as three "normal" internal relocations.

Because MIPS n64 has hitherto not used PLTs, the foo@plt code in
_bfd_elf_get_synthetic_symtab was not aware of this.  It assumed
that there was one internal relocation per jump slot.

Tested on mips64-linux-gnu and mips64el-linux-gnu.  OK to install?

Richard


bfd/
	* elf.c (_bfd_elf_get_synthetic_symtab): Increment p by
	bed->s->int_rels_per_ext_rel.

Index: bfd/elf.c
===================================================================
--- bfd/elf.c	2008-06-28 17:14:56.000000000 +0100
+++ bfd/elf.c	2008-06-28 17:14:58.000000000 +0100
@@ -8762,7 +8762,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
   count = relplt->size / hdr->sh_entsize;
   size = count * sizeof (asymbol);
   p = relplt->relocation;
-  for (i = 0; i < count; i++, p++)
+  for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel)
     size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt");
 
   s = *ret = bfd_malloc (size);
@@ -8772,7 +8772,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
   names = (char *) (s + count);
   p = relplt->relocation;
   n = 0;
-  for (i = 0; i < count; i++, p++)
+  for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel)
     {
       size_t len;
       bfd_vma addr;



More information about the Binutils mailing list