This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]