+2010-10-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf.c (byte_get_signed): Make it extern.
+
+ * dwarf.h (byte_get_signed): New.
+
+ * readelf.c (BYTE_GET_SIGNED): New.
+ (slurp_rela_relocs): Use BYTE_GET_SIGNED on r_addend.
+ (dump_relocations): Properly dump r_addend.
+
2010-10-08 Joseph Myers <joseph@codesourcery.com>
* nm.c (value_format_64bit): Define appropriately for __MSVCRT__.
debug_info;
extern dwarf_vma (*byte_get) (unsigned char *, int);
+extern dwarf_vma byte_get_signed (unsigned char *, int);
extern dwarf_vma byte_get_little_endian (unsigned char *, int);
extern dwarf_vma byte_get_big_endian (unsigned char *, int);
#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
-#define BYTE_GET(field) byte_get (field, sizeof (field))
+#define BYTE_GET(field) byte_get (field, sizeof (field))
+#define BYTE_GET_SIGNED(field) byte_get_signed (field, sizeof (field))
#define GET_ELF_SYMBOLS(file, section) \
(is_32bit_elf ? get_32bit_elf_symbols (file, section) \
{
relas[i].r_offset = BYTE_GET (erelas[i].r_offset);
relas[i].r_info = BYTE_GET (erelas[i].r_info);
- relas[i].r_addend = BYTE_GET (erelas[i].r_addend);
+ relas[i].r_addend = BYTE_GET_SIGNED (erelas[i].r_addend);
}
free (erelas);
{
relas[i].r_offset = BYTE_GET (erelas[i].r_offset);
relas[i].r_info = BYTE_GET (erelas[i].r_info);
- relas[i].r_addend = BYTE_GET (erelas[i].r_addend);
+ relas[i].r_addend = BYTE_GET_SIGNED (erelas[i].r_addend);
/* The #ifdef BFD64 below is to prevent a compile time
warning. We know that if we do not have a 64 bit data
if (is_rela)
{
- long off = (long) (bfd_signed_vma) rels[i].r_addend;
+ bfd_signed_vma off = rels[i].r_addend;
if (off < 0)
- printf (" - %lx", - off);
+ printf (" - %" BFD_VMA_FMT "x", - off);
else
- printf (" + %lx", off);
+ printf (" + %" BFD_VMA_FMT "x", off);
}
}
}