This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[gold][patch] Fix warning about refs to hidden symbols from shared libs
- From: Cary Coutant <ccoutant at google dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Tue, 18 Aug 2009 11:20:30 -0700
- Subject: [gold][patch] Fix warning about refs to hidden symbols from shared libs
In my last patch to add a warning for references to hidden and
internal symbols from shared libraries, I failed to consider the case
where the shared library symbols are actually definitions. In the case
where the main program has a hidden symbol named FOO, and the shared
library also defines a symbol named FOO, there is no cause to
complain. This patch fixes that case.
-cary
* resolve.cc (Symbol_table::resolve): Don't complain about defined
symbols in shared libraries overridden by hidden or internal symbols
in the main program.
Index: resolve.cc
===================================================================
RCS file: /cvs/src/src/gold/resolve.cc,v
retrieving revision 1.41
diff -u -p -r1.41 resolve.cc
--- resolve.cc 12 Aug 2009 18:30:39 -0000 1.41
+++ resolve.cc 18 Aug 2009 18:10:21 -0000
@@ -257,8 +257,10 @@ Symbol_table::resolve(Sized_symbol<size>
// 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)
+ else if (is_ordinary
+ && st_shndx == elfcpp::SHN_UNDEF
+ && (to->visibility() == elfcpp::STV_HIDDEN
+ || to->visibility() == elfcpp::STV_INTERNAL))
{
// A dynamic object cannot reference a hidden or internal symbol
// defined in another object.