This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Improve relocation overflow errors on MIPS.
- From: Cary Coutant <ccoutant at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 15 Mar 2017 23:51:49 -0000
- Subject: [binutils-gdb] Improve relocation overflow errors on MIPS.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c3847462f86778e97222a72378a84182f92c644a
commit c3847462f86778e97222a72378a84182f92c644a
Author: Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
Date: Wed Mar 15 15:43:25 2017 -0700
Improve relocation overflow errors on MIPS.
gold/
* mips.cc (Mips_relocate_functions::rel26): Don't print relocation
overflow error message.
(Target_mips::relocate_special_relocatable): Improve relocation
overflow error message.
(Target_mips::Relocate::relocate): Likewise.
Diff:
---
gold/ChangeLog | 8 ++++++++
gold/mips.cc | 33 +++++++++++++++++++++------------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 3102af5..a36faa1 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,13 @@
2017-03-15 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
+ * mips.cc (Mips_relocate_functions::rel26): Don't print relocation
+ overflow error message.
+ (Target_mips::relocate_special_relocatable): Improve relocation
+ overflow error message.
+ (Target_mips::Relocate::relocate): Likewise.
+
+2017-03-15 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
+
* mips.cc (symbol_refs_local): Return false if a symbol
is from a dynamic object.
(Target_mips::got_section): Make _GLOBAL_OFFSET_TABLE_ STV_HIDDEN.
diff --git a/gold/mips.cc b/gold/mips.cc
index 93b432a..c62ced3 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -4591,15 +4591,9 @@ class Mips_relocate_functions : public Relocate_functions<size, big_endian>
}
x = psymval->value(object, x) >> shift;
- if (!calculate_only && !local && !gsym->is_weak_undefined())
- {
- if ((x >> 26) != ((address + 4) >> (26 + shift)))
- {
- gold_error(_("relocation truncated to fit: %u against '%s'"),
- r_type, gsym->name());
- return This::STATUS_OVERFLOW;
- }
- }
+ if (!calculate_only && !local && !gsym->is_weak_undefined()
+ && ((x >> 26) != ((address + 4) >> (26 + shift))))
+ return This::STATUS_OVERFLOW;
val = Bits<32>::bit_select32(val, x, 0x03ffffff);
@@ -10307,7 +10301,9 @@ Target_mips<size, big_endian>::relocate_special_relocatable(
break;
case Reloc_funcs::STATUS_OVERFLOW:
gold_error_at_location(relinfo, relnum, reloc.get_r_offset(),
- _("relocation overflow"));
+ _("relocation overflow: "
+ "%u against local symbol %u in %s"),
+ r_type, r_sym, object->name().c_str());
break;
case Reloc_funcs::STATUS_BAD_RELOC:
gold_error_at_location(relinfo, relnum, reloc.get_r_offset(),
@@ -12188,8 +12184,21 @@ Target_mips<size, big_endian>::Relocate::relocate(
case Reloc_funcs::STATUS_OKAY:
break;
case Reloc_funcs::STATUS_OVERFLOW:
- gold_error_at_location(relinfo, relnum, r_offset,
- _("relocation overflow"));
+ if (gsym == NULL)
+ gold_error_at_location(relinfo, relnum, r_offset,
+ _("relocation overflow: "
+ "%u against local symbol %u in %s"),
+ r_type, r_sym, object->name().c_str());
+ else if (gsym->is_defined() && gsym->source() == Symbol::FROM_OBJECT)
+ gold_error_at_location(relinfo, relnum, r_offset,
+ _("relocation overflow: "
+ "%u against '%s' defined in %s"),
+ r_type, gsym->demangled_name().c_str(),
+ gsym->object()->name().c_str());
+ else
+ gold_error_at_location(relinfo, relnum, r_offset,
+ _("relocation overflow: %u against '%s'"),
+ r_type, gsym->demangled_name().c_str());
break;
case Reloc_funcs::STATUS_BAD_RELOC:
gold_error_at_location(relinfo, relnum, r_offset,