aboutsummaryrefslogtreecommitdiff
path: root/gold/target-reloc.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-07-09 06:11:34 +0000
committerIan Lance Taylor <ian@airs.com>2011-07-09 06:11:34 +0000
commitbeabb2c68ff9e09a1141cafd6f0b11ed98343290 (patch)
tree6a693410c82ed8e6edc622066771b6c1a380fa8e /gold/target-reloc.h
parent9c16daf1fcf87c2d75dea6775586135685237b4d (diff)
downloadgdb-beabb2c68ff9e09a1141cafd6f0b11ed98343290.zip
gdb-beabb2c68ff9e09a1141cafd6f0b11ed98343290.tar.gz
gdb-beabb2c68ff9e09a1141cafd6f0b11ed98343290.tar.bz2
PR gold/12386
* options.h (class General_options): Add --unresolved-symbols. * target-reloc.h (issue_undefined_symbol_error): Check --unresolved-symbols. Add comments.
Diffstat (limited to 'gold/target-reloc.h')
-rw-r--r--gold/target-reloc.h47
1 files changed, 40 insertions, 7 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index fabc0a9f..87fa593 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -176,13 +176,46 @@ visibility_error(const Symbol* sym)
inline bool
issue_undefined_symbol_error(const Symbol* sym)
{
- return (sym != NULL
- && (sym->is_undefined() || sym->is_placeholder())
- && sym->binding() != elfcpp::STB_WEAK
- && !sym->is_defined_in_discarded_section()
- && !parameters->target().is_defined_by_abi(sym)
- && (!parameters->options().shared()
- || parameters->options().defs()));
+ // We only report global symbols.
+ if (sym == NULL)
+ return false;
+
+ // We only report undefined symbols.
+ if (!sym->is_undefined() && !sym->is_placeholder())
+ return false;
+
+ // We don't report weak symbols.
+ if (sym->binding() == elfcpp::STB_WEAK)
+ return false;
+
+ // We don't report symbols defined in discarded sections.
+ if (sym->is_defined_in_discarded_section())
+ return false;
+
+ // If the target defines this symbol, don't report it here.
+ if (parameters->target().is_defined_by_abi(sym))
+ return false;
+
+ // See if we've been told to ignore whether this symbol is
+ // undefined.
+ const char* const u = parameters->options().unresolved_symbols();
+ if (u != NULL)
+ {
+ if (strcmp(u, "ignore-all") == 0)
+ return false;
+ if (strcmp(u, "ignore-in-object-files") == 0 && !sym->in_dyn())
+ return false;
+ if (strcmp(u, "ignore-in-shared-libs") == 0 && !sym->in_reg())
+ return false;
+ }
+
+ // When creating a shared library, only report unresolved symbols if
+ // -z defs was used.
+ if (parameters->options().shared() && !parameters->options().defs())
+ return false;
+
+ // Otherwise issue a warning.
+ return true;
}
// This function implements the generic part of relocation processing.