From: "H.J. Lu" <hongjiu.lu@intel.com>
To: binutils@sourceware.org
Subject: PATCH: Properly dump addend in readelf
Date: Sat, 02 Oct 2010 06:03:00 -0000 [thread overview]
Message-ID: <20101002060248.GA23161@intel.com> (raw)
"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);
}
}
}
next reply other threads:[~2010-10-02 6:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-02 6:03 H.J. Lu [this message]
2010-10-02 12:17 ` Joseph S. Myers
2010-10-02 12:46 ` H.J. Lu
2010-10-02 17:22 ` Joseph S. Myers
2010-10-02 22:27 ` H.J. Lu
2010-10-08 3:12 ` Alan Modra
2010-10-03 23:04 ` Maciej W. Rozycki
2010-10-08 3:22 ` Alan Modra
2010-10-08 3:17 ` Alan Modra
2010-10-08 15:13 ` Joseph S. Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101002060248.GA23161@intel.com \
--to=hongjiu.lu@intel.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).