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]

Re: [gold patch] Fix usage of invalidated version string in Symbol_table::define_special_symbol


Viktor Kutuzov <vkutuzov@accesssoftek.com> writes:

> I found that the Symbol_table::define_special_symbol method can return a
> pointer to an invalidated version string from the local std::string
> object (v) in case of condition only_if_ref == true. This patch should
> fix this problem.
>
> -Viktor.
>
> 	* symtab.cc (Symbol_table::define_special_symbol): Fix usage of
> 	the invalidated version string.

Thanks for the bug report and patch.  I don't think your approach is
entirely correct.  If the version is the default, we still want to look
up the symbol with a NULL version.  Also, if is_default_version is true
we know that *pversion != NULL.  I think this patch will fix the
problem.  Committed to mainline and 2.22 branch.

Ian


2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
	    Ian Lance Taylor  <iant@google.com>

	* symtab.cc (Symbol_table::define_special_symbol): Always
	canonicalize version string.


Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.159
diff -u -p -r1.159 symtab.cc
--- symtab.cc	1 Aug 2011 18:25:21 -0000	1.159
+++ symtab.cc	27 Sep 2011 23:55:25 -0000
@@ -1683,7 +1683,9 @@ Symbol_table::define_special_symbol(cons
 	return NULL;
 
       *pname = oldsym->name();
-      if (!is_default_version)
+      if (is_default_version)
+	*pversion = this->namepool_.add(*pversion, true, NULL);
+      else
 	*pversion = oldsym->version();
     }
   else

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