diff options
author | Cary Coutant <ccoutant@gmail.com> | 2018-07-14 12:29:03 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2018-07-14 12:29:50 -0700 |
commit | 1b115e8e0e051d65d0747f0a8a84eb6453866729 (patch) | |
tree | 9bd3161afbedbe8da6620bc2b823ea83679ee46a /gold/symtab.cc | |
parent | Update the notes on how to make a binutils release. (diff) | |
download | binutils-gdb-1b115e8e0e051d65d0747f0a8a84eb6453866729.tar.gz binutils-gdb-1b115e8e0e051d65d0747f0a8a84eb6453866729.tar.bz2 binutils-gdb-1b115e8e0e051d65d0747f0a8a84eb6453866729.zip |
Fix problem causing duplicated linker-generated symbols with versions.
When generating _end, _edata, etc. symbols, and a version script provides
a version name, and we are linking against another shared library that
provides those symbols with a different version, gold ends up trying to
resolve the other shared library's symbols to the new definitions, resulting
in two copies of each symbol, one as default, and one as non-default.
This patch tests for that condition, and ignores the symbols provided
by the other shared library.
gold/
PR gold/23409
* symtab.cc (Symbol_table::define_special_symbol): Add check for
version name on existing symbol.
* testsuite/Makefile.am (ver_test_pr23409): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ver_test_pr23409.sh: New test script.
* testsuite/ver_test_pr23409_1.script: New version script.
* testsuite/ver_test_pr23409_2.script: New version script.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r-- | gold/symtab.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc index c43d127507e..aa7644156f5 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -1898,10 +1898,13 @@ Symbol_table::define_special_symbol(const char** pname, const char** pversion, add_to_table = true; add_loc = ins.first; - if (is_default_version && !insdefault.second) + if (is_default_version + && !insdefault.second + && insdefault.first->second->version() == NULL) { // We are adding NAME/VERSION, and it is the default - // version. We already have an entry for NAME/NULL. + // version. We already have an entry for NAME/NULL + // that does not already have a version. oldsym = insdefault.first->second; *resolve_oldsym = true; } |