This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold patch] Fix usage of invalidated version string in Symbol_table::define_special_symbol
- From: Ian Lance Taylor <iant at google dot com>
- To: <vkutuzov at accesssoftek dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 27 Sep 2011 17:55:57 -0700
- Subject: Re: [gold patch] Fix usage of invalidated version string in Symbol_table::define_special_symbol
- References: <1316207113.7047.23.camel@dp690-dev5v9.accesssoftek.com>
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