* readelf.c (debug_apply_rela_addends): Reorder r_info as
authorMaciej W. Rozycki <macro@linux-mips.org>
Mon, 4 Apr 2005 15:07:18 +0000 (15:07 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Mon, 4 Apr 2005 15:07:18 +0000 (15:07 +0000)
necessary for 64-bit MIPS.

binutils/ChangeLog
binutils/readelf.c

index 54b6a432391d1cb6c451135c76b01f0f4704a0b5..7d47fad2b8fa3b1a5ae3f3baaf540a9b911381f8 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-04  Maciej W. Rozycki  <macro@linux-mips.org>
+
+       * readelf.c (debug_apply_rela_addends): Reorder r_info as
+       necessary for 64-bit MIPS.
+
 2005-04-04  Maciej W. Rozycki  <macro@linux-mips.org>
 
        * doc/binutils.texi (readelf): Remove a duplicate paragraph.
index d7bdf3eb2ecc17623920c3fbc58d99ee300707a9..fe4c8157bb43d4567c8ad7da065ab759c236150d 100644 (file)
@@ -7395,6 +7395,18 @@ debug_apply_rela_addends (FILE *file,
            }
          else
            {
+             /* In MIPS little-endian objects, r_info isn't really a
+                64-bit little-endian value: it has a 32-bit little-endian
+                symbol index followed by four individual byte fields.
+                Reorder INFO accordingly.  */
+             if (elf_header.e_machine == EM_MIPS
+                 && elf_header.e_ident[EI_DATA] != ELFDATA2MSB)
+               rp->r_info = (((rp->r_info & 0xffffffff) << 32)
+                             | ((rp->r_info >> 56) & 0xff)
+                             | ((rp->r_info >> 40) & 0xff00)
+                             | ((rp->r_info >> 24) & 0xff0000)
+                             | ((rp->r_info >> 8) & 0xff000000));
+
              sym = symtab + ELF64_R_SYM (rp->r_info);
 
              if (ELF64_R_SYM (rp->r_info) != 0