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 committed: Only warn if ambiguous version is used


Building gcc with gold, I discovered that the libgcc version script for
x86_64 is ambiguous.  __multc3, among other symbols, appears twice.  It
appears that this is being used essentially as documentation: the
symbols actually get their versions from .symver directives.  There is
no actual ambiguity here.

I changed the version script ambiguity detection I recently added to
gold so that it only warns if the linker is going to use the
ambiguity--if the linker looks up the ambiguous symbol to find out its
version.

Committed to mainline.

Ian


2010-01-08  Ian Lance Taylor  <iant@google.com>

	* script.cc (Version_script_info::build_expression_list_lookup):
	Don't warn about ambiguous version, just record the ambiguity.
	(Version_script_info::get_symbol_version_helper): Give error if
	version is ambiguous.


Index: script.cc
===================================================================
RCS file: /cvs/src/src/gold/script.cc,v
retrieving revision 1.65
diff -p -u -r1.65 script.cc
--- script.cc	6 Jan 2010 05:30:24 -0000	1.65
+++ script.cc	9 Jan 2010 05:48:29 -0000
@@ -1957,11 +1957,13 @@ Version_script_info::build_expression_li
 	  if (!ins.second)
 	    {
 	      const Version_tree* v1 = ins.first->second;
-	      if (v1->tag != v->tag)
-		gold_error(_("'%s' appears in version script with both "
-			     "versions '%s' and '%s'"),
-			   exp.pattern.c_str(), v1->tag.c_str(),
-			   v->tag.c_str());
+	      if (v1 != NULL && v1->tag != v->tag)
+		{
+		  // This is an ambiguous match.  It's OK if it's just
+		  // documenting symbol versions, but not if we look
+		  // up this symbol.
+		  ins.first->second = NULL;
+		}
 	    }
 	}
     }
@@ -2037,7 +2039,16 @@ Version_script_info::get_symbol_version_
       if (pe != lookup->exact.end())
 	{
 	  if (pversion != NULL)
-	    *pversion = pe->second->tag;
+	    {
+	      if (pe->second != NULL)
+		*pversion = pe->second->tag;
+	      else
+		{
+		  gold_error(_("'%s' has multiple versions in version script"),
+			     name_to_match);
+		  return false;
+		}
+	    }
 
 	  // If we are using --no-undefined-version, and this is a
 	  // global symbol, we have to record that we have found this

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