aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2018-04-05 14:51:37 -0700
committerCary Coutant <ccoutant@gmail.com>2018-04-05 14:51:45 -0700
commitc54b27d1c04f53043688d5d3141e74ae5c23aba8 (patch)
tree915edfed0c0ea26a6f1eb2efff7f9b2956757850 /gold
parent2d8c1a2318a75f43491bdc7acbeb24590145d7a6 (diff)
downloadgdb-c54b27d1c04f53043688d5d3141e74ae5c23aba8.zip
gdb-c54b27d1c04f53043688d5d3141e74ae5c23aba8.tar.gz
gdb-c54b27d1c04f53043688d5d3141e74ae5c23aba8.tar.bz2
Improve warnings for relocations referring to discarded sections.
gold/ * target-reloc.h (relocate_section): Add local symbol index or global symbol name to warning about relocation that refers to discarded section.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/target-reloc.h23
2 files changed, 25 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 010dad4..97777aa 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2018-04-05 Cary Coutant <ccoutant@gmail.com>
+
+ * target-reloc.h (relocate_section): Add local symbol index or global
+ symbol name to warning about relocation that refers to discarded
+ section.
+
2018-04-05 James Cowgill <james.cowgill@mips.com>
Revert previous patch and apply revised patch.
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index f52e42f..36032fb 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -305,6 +305,7 @@ relocate_section(
const Symbol_value<size> *psymval;
bool is_defined_in_discarded_section;
unsigned int shndx;
+ const Symbol* gsym = NULL;
if (r_sym < local_count
&& (reloc_symbol_changes == NULL
|| (*reloc_symbol_changes)[i] == NULL))
@@ -327,7 +328,6 @@ relocate_section(
}
else
{
- const Symbol* gsym;
if (reloc_symbol_changes != NULL
&& (*reloc_symbol_changes)[i] != NULL)
gsym = (*reloc_symbol_changes)[i];
@@ -383,9 +383,24 @@ relocate_section(
else
{
if (comdat_behavior == CB_WARNING)
- gold_warning_at_location(relinfo, i, offset,
- _("relocation refers to discarded "
- "section"));
+ {
+ if (gsym == NULL)
+ {
+ gold_warning_at_location(
+ relinfo, i, offset,
+ _("relocation refers to local symbol %d "
+ "defined in discarded section"),
+ r_sym);
+ }
+ else
+ {
+ gold_warning_at_location(
+ relinfo, i, offset,
+ _("relocation refers to symbol \"%s\" "
+ "defined in discarded section"),
+ gsym->demangled_name().c_str());
+ }
+ }
symval2.set_output_value(0);
}
symval2.set_no_output_symtab_entry();