123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- From f984741df04cd68bb116073fdfa9405808810ab4 Mon Sep 17 00:00:00 2001
- From: Cary Coutant <ccoutant@google.com>
- Date: Wed, 5 Feb 2014 22:59:02 -0800
- Subject: [PATCH] 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.
- diff --git a/gold/ChangeLog b/gold/ChangeLog
- index dcf7ed41f8..dd7ef72980 100644
- --- a/gold/ChangeLog
- +++ b/gold/ChangeLog
- @@ -1,3 +1,14 @@
- +2014-02-05 Cary Coutant <ccoutant@google.com>
- +
- + Fix issues with gold undefined symbol diagnostics.
- +
- + PR binutils/15435
- + * 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.
- +
- 2013-11-22 Cary Coutant <ccoutant@google.com>
-
- * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
- diff --git a/gold/errors.cc b/gold/errors.cc
- index b79764bd1d..98db0fdd86 100644
- --- a/gold/errors.cc
- +++ b/gold/errors.cc
- @@ -193,6 +193,11 @@ Errors::undefined_symbol(const Symbol* sym, const std::string& location)
- fprintf(stderr,
- _("%s: %s: undefined reference to '%s', version '%s'\n"),
- location.c_str(), zmsg, sym->demangled_name().c_str(), version);
- +
- + if (sym->is_cxx_vtable())
- + gold_info(_("%s: the vtable symbol may be undefined because "
- + "the class is missing its key function"),
- + program_name);
- }
-
- // Issue a debugging message.
- diff --git a/gold/target-reloc.h b/gold/target-reloc.h
- index b544c78f37..d609bcbaa8 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())
- --
- 2.11.0
|