summaryrefslogtreecommitdiff
path: root/gold/target-reloc.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2014-02-05 22:59:02 -0800
committerCary Coutant <ccoutant@google.com>2014-02-05 23:04:52 -0800
commit1a221d3d9cc474b8a382f6aeed56671d10b71473 (patch)
tree99fa5ba79d8f2849d6def72a1d648669f960bf75 /gold/target-reloc.h
parente889f0a4b14d265cb6ef5f51bdf0daeb0d7caf1e (diff)
downloadbinutils-gdb-1a221d3d9cc474b8a382f6aeed56671d10b71473.tar.gz
Fix issues with gold undefined symbol diagnostics.
PR binutils/15435 complains that gold issues a visibility error for an weak undefined symbol with hidden visibility. The message should be suppressed if the symbol is a weak undef. An earlier patch to add an extra note about key functions when a class's vtable symbol is undefined missed a case where the reference to the vtable came from a shared library. This patch moves the check to a lower-level routine that catches both cases. gold/ 2014-02-05 Cary Coutant <ccoutant@google.com> * errors.cc (Errors::undefined_symbol): Move undef vtable symbol check to here. * target-reloc.h (is_strong_undefined): New function. (relocate_section): Move undef vtable symbol check from here. Check for is_strong_undefined.
Diffstat (limited to 'gold/target-reloc.h')
-rw-r--r--gold/target-reloc.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index b544c78f371..d609bcbaa8b 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -144,6 +144,12 @@ class Default_comdat_behavior
}
};
+inline bool
+is_strong_undefined(const Symbol* sym)
+{
+ return sym->is_undefined() && sym->binding() != elfcpp::STB_WEAK;
+}
+
// Give an error for a symbol with non-default visibility which is not
// defined locally.
@@ -411,16 +417,10 @@ relocate_section(
}
if (issue_undefined_symbol_error(sym))
- {
- gold_undefined_symbol_at_location(sym, relinfo, i, offset);
- if (sym->is_cxx_vtable())
- gold_info(_("%s: the vtable symbol may be undefined because "
- "the class is missing its key function"),
- program_name);
- }
+ gold_undefined_symbol_at_location(sym, relinfo, i, offset);
else if (sym != NULL
&& sym->visibility() != elfcpp::STV_DEFAULT
- && (sym->is_undefined() || sym->is_from_dynobj()))
+ && (is_strong_undefined(sym) || sym->is_from_dynobj()))
visibility_error(sym);
if (sym != NULL && sym->has_warning())