This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[gold] PATCH: Correct relocation offset
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Cc: Cary Coutant <ccoutant at google dot com>, Ian Lance Taylor <iant at google dot com>
- Date: Fri, 27 Jan 2012 14:26:43 -0800
- Subject: [gold] PATCH: Correct relocation offset
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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;
}