This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold] PATCH: Correct relocation offset


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]