[gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update
H.J. Lu
hongjiu.lu@intel.com
Thu Jan 3 19:00:00 GMT 2013
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);
}
More information about the Binutils
mailing list