public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold] PATCH: Correct relocation offset
@ 2012-01-27 22:26 H.J. Lu
  2012-01-27 23:14 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2012-01-27 22:26 UTC (permalink / raw)
  To: binutils; +Cc: Cary Coutant, Ian Lance Taylor

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;
 	      }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gold] PATCH: Correct relocation offset
  2012-01-27 22:26 [gold] PATCH: Correct relocation offset H.J. Lu
@ 2012-01-27 23:14 ` Ian Lance Taylor
  2012-01-28  0:22   ` Cary Coutant
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2012-01-27 23:14 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils, Cary Coutant

"H.J. Lu" <hongjiu.lu@intel.com> writes:

> 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
>
> 	* incremental.cc (write_info_blocks): Correct relocation offset.

This is OK if it's OK with Cary.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gold] PATCH: Correct relocation offset
  2012-01-27 23:14 ` Ian Lance Taylor
@ 2012-01-28  0:22   ` Cary Coutant
  0 siblings, 0 replies; 3+ messages in thread
From: Cary Coutant @ 2012-01-28  0:22 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: H.J. Lu, binutils

>> 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * incremental.cc (write_info_blocks): Correct relocation offset.
>
> This is OK if it's OK with Cary.

It's OK with me. Thanks!

-cary

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-28  0:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27 22:26 [gold] PATCH: Correct relocation offset H.J. Lu
2012-01-27 23:14 ` Ian Lance Taylor
2012-01-28  0:22   ` Cary Coutant

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).