PATCH: Properly dump addend in readelf
H.J. Lu
hongjiu.lu@intel.com
Sat Oct 2 06:03:00 GMT 2010
"readelf -r" failed to dump addend in 32bit ELF with 64bit VMA. It
happpens on Linux/mips64:
FAIL: ld-mips-elf/reloc-1-n32
Also we can't assume long is always 64bit. This patch uses long long
instead. OK to install?
Thanks.
H.J.
----
2010-10-01 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (dump_relocations): Properly dump addend.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b91c5ba..876827d 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1410,12 +1410,17 @@ dump_relocations (FILE * file,
if (is_rela)
{
- long off = (long) (bfd_signed_vma) rels[i].r_addend;
+ long long off;
+
+ if (is_32bit_elf)
+ off = (long long) (int) rels[i].r_addend;
+ else
+ off = rels[i].r_addend;
if (off < 0)
- printf (" - %lx", - off);
+ printf (" - %llx", - off);
else
- printf (" + %lx", off);
+ printf (" + %llx", off);
}
}
}
More information about the Binutils
mailing list