This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Thu, 3 Jan 2013 11:00:16 -0800
- Subject: [gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
We set negative section offset in Input_section::set_address_and_file_offset,
when storing section offset as an address. Although it is overridden by
Sized_relobj_file<size, big_endian>::layout_section later, the negative
offset doesn't work on x32 since a section offset (18446744073709551050
== 0xFFFFFFFFFFFFFDCA == -3530) that doesn't fit in a 32-bit Address.
This patch changes negative offset to -1, which is converted to
invalid_address. Tested it on x86-64, x32 and ia32. OK to install?
Thanks.
H.J.
---
2013-01-03 H.J. Lu <hongjiu.lu@intel.com>
PR gold/14993
* output.cc (Output_section::Input_section::set_address_and_file_offset):
Set negative offset to -1.
diff --git a/gold/output.cc b/gold/output.cc
index f2321b7..75feb74 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2152,8 +2152,12 @@ Output_section::Input_section::set_address_and_file_offset(
off_t section_file_offset)
{
if (this->is_input_section())
- this->u2_.object->set_section_offset(this->shndx_,
- file_offset - section_file_offset);
+ {
+ file_offset -= section_file_offset;
+ if (file_offset < 0)
+ file_offset = static_cast<off_t>(-1);
+ this->u2_.object->set_section_offset(this->shndx_, file_offset);
+ }
else
this->u2_.posd->set_address_and_file_offset(address, file_offset);
}