This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold commit] PR 18695: Add additional information to relocation overflow errors
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Sun, 7 Feb 2016 10:47:54 -0800
- Subject: Re: [gold commit] PR 18695: Add additional information to relocation overflow errors
- Authentication-results: sourceware.org; auth=none
- References: <CAJimCsGUSQ5B1kP5innHkag=BJvZbXupD34NRk1am7Z4HweQzw at mail dot gmail dot com>
On Sun, Feb 7, 2016 at 10:18 AM, Cary Coutant <ccoutant@gmail.com> wrote:
> This patch adds some additional useful information to the relocation
> overflow errors for x86_64.
>
> -cary
>
>
> 2016-02-07 Cary Coutant <ccoutant@gmail.com>
>
> gold/
> PR gold/18695
> * x86_64.cc (Target_x86_64::Relocate::relocate): Add additional
> information to relocation overflow errors.
>
> diff --git a/gold/x86_64.cc b/gold/x86_64.cc
> index b0780af..81126ef 100644
> --- a/gold/x86_64.cc
> +++ b/gold/x86_64.cc
> @@ -3701,8 +3701,30 @@ Target_x86_64<size>::Relocate::relocate(
> }
>
> if (rstatus == Reloc_funcs::RELOC_OVERFLOW)
> - gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
> - _("relocation overflow"));
> + {
> + if (gsym == NULL)
> + {
> + unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
> + gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
> + _("relocation overflow: "
> + "reference to local symbol %u in %s"),
> + r_sym, object->name().c_str());
> + }
> + else if (gsym->is_defined() && gsym->source() == Symbol::FROM_OBJECT)
> + {
> + gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
> + _("relocation overflow: "
> + "reference to '%s' defined in %s"),
> + gsym->name(),
> + gsym->object()->name().c_str());
> + }
> + else
> + {
> + gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
> + _("relocation overflow: reference to '%s'"),
> + gsym->name());
> + }
> + }
>
> return true;
> }
Can you add relocation number? Different relocations may be against
the same symbol.
Thanks.
--
H.J.