Add additional information to relocation overflow errors.
authorCary Coutant <ccoutant@gmail.com>
Sun, 7 Feb 2016 18:17:01 +0000 (10:17 -0800)
committerCary Coutant <ccoutant@gmail.com>
Sun, 7 Feb 2016 18:17:01 +0000 (10:17 -0800)
gold/
PR gold/18695
* x86_64.cc (Target_x86_64::Relocate::relocate): Add additional
information to relocation overflow errors.

gold/ChangeLog
gold/x86_64.cc

index d824511082d4fe7cbd096d7424d521eb493aa1ae..b796a246bba427bea6cf0016dd6ddb1744791d79 100644 (file)
@@ -1,5 +1,12 @@
+2016-02-07  Cary Coutant  <ccoutant@gmail.com>
+
+       PR gold/18695
+       * x86_64.cc (Target_x86_64::Relocate::relocate): Add additional
+       information to relocation overflow errors.
+
 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
 
+       PR gold/18695
        * x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32
        overflow checking when symbol value + addend < 0.
 
index b0780af10019a7300e5243b7edeefe4cc0fdd0c7..81126efc84ed14513c303adc90df2e91ede996b8 100644 (file)
@@ -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;
 }