This is the mail archive of the
mailing list for the binutils project.
Re: [gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update
- From: Cary Coutant <ccoutant at google dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Thu, 3 Jan 2013 11:47:49 -0800
- Subject: Re: [gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update
- References: <20130103190016.GA13992@intel.com>
> 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?
I don't think the negative file offset should be happening in the
first place, and it seems to be caused by the fact that we've turned
on input section tracking for .text. With an incremental update, the
offset assigned in Output_section::add_input_section should be final
(and non-negative), and it shouldn't be overridden later in
Sized_relobj_file::layout_section. I think the right solution is to
suppress section sorting during an incremental update -- the two are
fundamentally incompatible. I'll take a closer look at this.
> + if (file_offset < 0)
> + file_offset = static_cast<off_t>(-1);
No need for the cast here.
Thanks for the analysis.