[gold] Error out when there is an access beyond the end of the merged section

Cary Coutant ccoutant@google.com
Tue Jul 1 20:18:00 GMT 2014


> +2014-07-01  Alexander Ivchenko  <alexander.ivchenko@intel.com>
> +
> + * merge.cc (Object_merge_map::get_output_offset): error out when we see
> + that there is an access beyond the end of the merged section.
> + * merge.h (Object_merge_map::get_output_offset): Add new argument.
> + (Merge_map::get_output_offset): Adjust
> + Object_merge_map::get_output_offset call with additional argument.
> + * reloc.cc (Merged_symbol_value<size>::value_from_output_section):
> + Ditto.

I don't think Object_merge_map or Merge_map should be printing this
error. Instead, I'd prefer to issue the error from
Merged_symbol_value::value_from_output_section in place of the
gold_assert. Everything needed to print the error message is readily
available there.

It would be nice to print the section name as well as the offset. You
should just be able to replace gold_assert with this:

  if (!found)
    {
      object->error(_("access beyond end of merged section (%s+%ld)"),
                    object->section_name(input_shndx),
                    static_cast<long>(input_offset));
      return 0;
    }

Thanks for looking at this!

-cary



More information about the Binutils mailing list