From 645afe0c5b028b013231f5890f66376e4dfc811d Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Wed, 12 Aug 2009 18:30:39 +0000 Subject: PR 10471 * resolve.cc (Symbol_table::resolve): Check for references from dynamic objects to hidden and internal symbols. * testsuite/Makefile.am (hidden_test.sh): New test. * testsuite/Makefile.in: Regenerate. * testsuite/hidden_test.sh: New script. * testsuite/hidden_test_1.c: New test source. * testsuite/hidden_test_main.c: New test source. --- gold/resolve.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gold/resolve.cc') diff --git a/gold/resolve.cc b/gold/resolve.cc index 9da963f..7299c55 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -257,6 +257,20 @@ Symbol_table::resolve(Sized_symbol* to, // Record that we've seen this symbol in a regular object. to->set_in_reg(); } + else if (to->visibility() == elfcpp::STV_HIDDEN + || to->visibility() == elfcpp::STV_INTERNAL) + { + // A dynamic object cannot reference a hidden or internal symbol + // defined in another object. + gold_warning(_("%s symbol '%s' in %s is referenced by DSO %s"), + (to->visibility() == elfcpp::STV_HIDDEN + ? "hidden" + : "internal"), + to->demangled_name().c_str(), + to->object()->name().c_str(), + object->name().c_str()); + return; + } else { // Record that we've seen this symbol in a dynamic object. -- cgit v1.1