This is the mail archive of the 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]

Re: [gold] PATCH: PR gold/14993: Section sorting interferes with the incremental update

> 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.


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