diff options
author | Cary Coutant <ccoutant@gmail.com> | 2015-08-25 17:53:53 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2015-08-25 17:53:53 -0700 |
commit | 3ac0a36c297a7bb3325c6efa756cccc40572dbdb (patch) | |
tree | ef53f171f2769e3544750adbba092d20389c82ee /gold | |
parent | dc72bf948acc0b3cca517c730a3103d9b1d072b3 (diff) | |
download | gdb-3ac0a36c297a7bb3325c6efa756cccc40572dbdb.zip gdb-3ac0a36c297a7bb3325c6efa756cccc40572dbdb.tar.gz gdb-3ac0a36c297a7bb3325c6efa756cccc40572dbdb.tar.bz2 |
Fix regression introduced by fix for PR 18703.
When a user object overrides a versioned definition in a shared object,
it's possible to trigger an internal error because the versioned
definition we saw didn't override the unversioned definition. This
was introduced by the fix for PR 18703. This patch fixes the problem
by reordering the tests so that we do not check ret->is_default()
until we're confident that the symbol is in fact versioned.
gold/
PR gold/18866
PR gold/18703
* symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 6 | ||||
-rw-r--r-- | gold/symtab.cc | 32 |
2 files changed, 23 insertions, 15 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index b3417b2..5190e7e 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2015-08-25 Cary Coutant <ccoutant@gmail.com> + + PR gold/18866 + PR gold/18703 + * symtab.cc (Symbol_table): Reorder conditions to avoid internal error. + 2015-08-20 Alan Modra <amodra@gmail.com> PR gold/18846 diff --git a/gold/symtab.cc b/gold/symtab.cc index 7e30fbf..c6b47b0 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -998,26 +998,28 @@ Symbol_table::add_from_object(Object* object, if (is_default_version) this->define_default_version<size, big_endian>(ret, insdefault.second, insdefault.first); - else if (version != NULL && ret->is_default()) + else { - // We have seen NAME/VERSION already, and marked it as the - // default version, but now we see a definition for - // NAME/VERSION that is not the default version. This can - // happen when the assembler generates two symbols for - // a symbol as a result of a ".symver foo,foo@VER" - // directive. We see the first unversioned symbol and - // we may mark it as the default version (from a - // version script); then we see the second versioned - // symbol and we need to override the first. - // In any other case, the two symbols should have generated - // a multiple definition error. - // (See PR gold/18703.) bool dummy; - if (ret->source() == Symbol::FROM_OBJECT + if (version != NULL + && ret->source() == Symbol::FROM_OBJECT && ret->object() == object && is_ordinary - && ret->shndx(&dummy) == st_shndx) + && ret->shndx(&dummy) == st_shndx + && ret->is_default()) { + // We have seen NAME/VERSION already, and marked it as the + // default version, but now we see a definition for + // NAME/VERSION that is not the default version. This can + // happen when the assembler generates two symbols for + // a symbol as a result of a ".symver foo,foo@VER" + // directive. We see the first unversioned symbol and + // we may mark it as the default version (from a + // version script); then we see the second versioned + // symbol and we need to override the first. + // In any other case, the two symbols should have generated + // a multiple definition error. + // (See PR gold/18703.) ret->set_is_not_default(); const Stringpool::Key vnull_key = 0; this->table_.erase(std::make_pair(name_key, vnull_key)); |