public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hongjiu.lu@intel.com>
To: binutils@sourceware.org
Cc: Cary Coutant <ccoutant@google.com>, Ian Lance Taylor <iant@google.com>
Subject: [gold] PATCH: Correct relocation offset
Date: Fri, 27 Jan 2012 22:26:00 -0000	[thread overview]
Message-ID: <20120127222643.GA23840@intel.com> (raw)

Hi,

The layout of .gnu_incremental_relocs section entry is

4byte: r_type
4byte: out_shndx
addr_size: offset
addr_size: addend

and incremental.cc uses

8 + 2 * parameters->target().get_size() / 8;

or

8 + 2 * sizeof_add

to compute .gnu_incremental_relocs entry size.  However,
write_info_blocks uses "3 * sizeof_addr", which only works for 64bit
target.  This patch fixes it.  OK to install?

Thanks.


H.J.
--
2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>

	* incremental.cc (write_info_blocks): Correct relocation offset.

diff --git a/gold/incremental.cc b/gold/incremental.cc
index 39bad37..2a26573 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -1632,7 +1632,8 @@ Output_section_incremental_inputs<size, big_endian>::write_info_blocks(
 		Swap32::writeval(pov + 4, shndx);
 		Swap32::writeval(pov + 8, chain);
 		Swap32::writeval(pov + 12, nrelocs);
-		Swap32::writeval(pov + 16, first_reloc * 3 * sizeof_addr);
+		Swap32::writeval(pov + 16,
+				 first_reloc * (8 + 2 * sizeof_addr));
 		pov += 20;
 	      }
 

             reply	other threads:[~2012-01-27 22:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 22:26 H.J. Lu [this message]
2012-01-27 23:14 ` Ian Lance Taylor
2012-01-28  0:22   ` Cary Coutant

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=20120127222643.GA23840@intel.com \
    --to=hongjiu.lu@intel.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@google.com \
    --cc=hjl.tools@gmail.com \
    --cc=iant@google.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).