[gold patch] Fix incremental update problems with shared objects and versioned symbols
Cary Coutant
ccoutant@google.com
Wed Sep 28 01:42:00 GMT 2011
This patch fixes a crash that can happen when all the objects that
reference a PLT symbol are replaced during an incremental update
(missing test for NULL). That fix exposed another where if a changed
shared object contains a reference to a versioned symbol that is
defined in an unchanged shared object, we cannot resolve the reference
because the incremental info does not (yet) store version information.
Adding version support is for a later patch; for now, I ignore
incoming version references during an incremental update.
OK to commit?
-cary
* gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
Check for NULL.
* gold/symtab.cc (Symbol_table::add_from_relobj): Ignore version
symbols during incremental update.
(Symbol_table::add_from_dynobj): Likewise.
-------------- next part --------------
2011-09-27 Cary Coutant <ccoutant@google.com>
* gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
Check for NULL.
* gold/symtab.cc (Symbol_table::add_from_relobj): Ignore version
symbols during incremental update.
(Symbol_table::add_from_dynobj): Likewise.
commit ef3c2022d3a23abd0ab2630570807897c8122c7f
Author: Cary Coutant <ccoutant@google.com>
Date: Tue Sep 27 18:35:17 2011 -0700
Fix crash when shared lib is changed; fix undef versioned symbol.
diff --git a/gold/incremental.cc b/gold/incremental.cc
index b422827..cbf6fba 100644
--- a/gold/incremental.cc
+++ b/gold/incremental.cc
@@ -685,7 +685,7 @@ Sized_incremental_binary<size, big_endian>::do_process_got_plt(
gold_assert(plt_desc >= first_global && plt_desc < symtab_count);
Symbol* sym = this->global_symbol(plt_desc - first_global);
// Add the PLT entry only if the symbol is still referenced.
- if (sym->in_reg())
+ if (sym != NULL && sym->in_reg())
{
gold_debug(DEBUG_INCREMENTAL,
"PLT entry %d: %s",
diff --git a/gold/symtab.cc b/gold/symtab.cc
index ff6ff84..497cc82 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -1143,6 +1143,14 @@ Symbol_table::add_from_relobj(
bool is_default_version = false;
bool is_forced_local = false;
+ // FIXME: For incremental links, we don't store version information,
+ // so we need to ignore version symbols for now.
+ if (parameters->incremental_update() && ver != NULL)
+ {
+ namelen = ver - name;
+ ver = NULL;
+ }
+
if (ver != NULL)
{
// The symbol name is of the form foo@VERSION or foo@@VERSION
@@ -1346,6 +1354,11 @@ Symbol_table::add_from_dynobj(
return;
}
+ // FIXME: For incremental links, we don't store version information,
+ // so we need to ignore version symbols for now.
+ if (parameters->incremental_update())
+ versym = NULL;
+
if (versym != NULL && versym_size / 2 < count)
{
dynobj->error(_("too few symbol versions"));
More information about the Binutils
mailing list