aboutsummaryrefslogtreecommitdiff
path: root/gold/target-reloc.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-03-21 19:07:55 -0700
committerCary Coutant <ccoutant@gmail.com>2016-03-21 21:42:15 -0700
commit648c5cbbf34dcbf96bde7e07b14868777fd5d635 (patch)
treeb2d83b9ce51b0a3d3d84601c675f606b89134520 /gold/target-reloc.h
parent6f4c0a426c653867c40936a9b8f503628adbd64b (diff)
downloadgdb-648c5cbbf34dcbf96bde7e07b14868777fd5d635.zip
gdb-648c5cbbf34dcbf96bde7e07b14868777fd5d635.tar.gz
gdb-648c5cbbf34dcbf96bde7e07b14868777fd5d635.tar.bz2
Fix problem where gold fails to issue an undefined symbol error during LTO.
During LTO, if (1) an IR file contains a COMDAT group that is kept, (2) a later non-claimed file contains the same group, which we discard, and (3) the plugin fails to provide a definition of the symbols in that COMDAT group, gold silently resolves any references to those symbols to 0. This patch adds a check for a placeholder symbol when deciding whether to issue an undefined symbol error. It also adds an extra note after any undefined placeholder symbol error that explains that a definition was expected from the plugin. gold/ PR gold/19842 * errors.cc (Errors::undefined_symbol): Add info message when symbol should have been provided by a plugin. * target-reloc.h (issue_undefined_symbol_error): Check for placeholder symbols defined in discarded sections. * testsuite/Makefile.am (plugin_test_9b): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test_9b_elf.cc: New test source file. * testsuite/plugin_test_9b_ir.cc: New test source file.
Diffstat (limited to 'gold/target-reloc.h')
-rw-r--r--gold/target-reloc.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index bdf673d..e275d33 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -186,8 +186,10 @@ issue_undefined_symbol_error(const Symbol* sym)
if (sym->is_weak_undefined())
return false;
- // We don't report symbols defined in discarded sections.
- if (sym->is_defined_in_discarded_section())
+ // We don't report symbols defined in discarded sections,
+ // unless they're placeholder symbols that should have been
+ // provided by a plugin.
+ if (sym->is_defined_in_discarded_section() && !sym->is_placeholder())
return false;
// If the target defines this symbol, don't report it here.