public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold patch] Incremental 26/26: Fix problem with hidden/internal symbols
@ 2011-06-09  0:02 Cary Coutant
  2011-07-05 21:08 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Cary Coutant @ 2011-06-09  0:02 UTC (permalink / raw)
  To: Binutils, Ian Lance Taylor

OK, one more -- then I'll stop numbering them.

This patch fixes a case where a hidden symbol overrides one defined in
a shared library. If we mark the def in the shared library as an
UNDEF, we'll complain about a reference to a hidden or internal symbol
during the incremental update where we don't complain during the full
link. Instead, the right thing to do is mark it as a DEF, and it'll go
through the same resolve logic as the first time around.

-cary


2011-06-08  Cary Coutant  <ccoutant@google.com>

	* gold/incremental.cc
	(Output_section_incremental_inputs::write_info_blocks): Check for
	hidden and internal symbols.


diff --git a/gold/incremental.cc b/gold/incremental.cc
index 710effc..cb97044 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -1669,9 +1669,15 @@ Output_section_incremental_inputs<size,
big_endian>::write_info_blocks(
 	        if (sym->symtab_index() == -1U)
 	          continue;
 		unsigned int flags = 0;
-		if (sym->source() == Symbol::FROM_OBJECT
-		    && sym->object() == obj
-		    && sym->is_defined())
+		// If the symbol has hidden or internal visibility, we
+		// mark it as defined in the shared object so we don't
+		// try to resolve it during an incremental update.
+		if (sym->visibility() == elfcpp::STV_HIDDEN
+		    || sym->visibility() == elfcpp::STV_INTERNAL)
+		  flags = INCREMENTAL_SHLIB_SYM_DEF;
+		else if (sym->source() == Symbol::FROM_OBJECT
+			 && sym->object() == obj
+			 && sym->is_defined())
 		  flags = INCREMENTAL_SHLIB_SYM_DEF;
 		else if (sym->is_copied_from_dynobj()
 			 && this->symtab_->get_copy_source(sym) == dynobj)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gold patch] Incremental 26/26: Fix problem with hidden/internal symbols
  2011-06-09  0:02 [gold patch] Incremental 26/26: Fix problem with hidden/internal symbols Cary Coutant
@ 2011-07-05 21:08 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-07-05 21:08 UTC (permalink / raw)
  To: Cary Coutant; +Cc: Binutils

Cary Coutant <ccoutant@google.com> writes:

> 2011-06-08  Cary Coutant  <ccoutant@google.com>
>
> 	* gold/incremental.cc
> 	(Output_section_incremental_inputs::write_info_blocks): Check for
> 	hidden and internal symbols.

This is OK.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-05 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09  0:02 [gold patch] Incremental 26/26: Fix problem with hidden/internal symbols Cary Coutant
2011-07-05 21:08 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).