This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
symbol versioning, take 2
- From: Phil Edwards <phil at jaj dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 13 Feb 2002 17:47:23 -0500
- Subject: symbol versioning, take 2
On Mon, Feb 11, 2002 at 06:16:30PM -0800, Benjamin Kosnik wrote:
> Just as a note to those interested, this thread has moved over to the
> binutils list.
...and now it's back. It is the Thread That Will Not Die.
Summary thus far: providing a version script to the linker becomes much
much easier if we require GNU ld. (Actually, GNU ld plus some patches
of mine waiting for binutils approval.) We get to use non-mangled names,
and globbing patterns. More on other linkers below.
Thus armed, I wrote a version script that exposes enough symbols to allow
all our testsuite programs to build. This is interesting, though: here
are the previous (unversioned) results on my system:
# of expected passes 351
# of unexpected failures 3
# of unexpected successes 1
# of expected failures 24
XPASS: 22_locale/collate_members_wchar_t.cc execution test
FAIL: 23_containers/list_modifiers.cc (test for excess errors)
WARNING: 23_containers/list_modifiers.cc compilation failed to produce executable
FAIL: 23_containers/map_operators.cc (test for excess errors)
FAIL: 26_numerics/c99_classification_macros_c.cc (test for excess errors)
Yes, that's normal for me, ignore that right now. But after versioning:
# of expected passes 341
# of unexpected failures 13
# of unexpected successes 1
# of expected failures 24
FAIL: 21_strings/append.cc execution test
FAIL: 21_strings/ctor_copy_dtor.cc execution test
FAIL: 21_strings/element_access.cc execution test
FAIL: 21_strings/insert.cc execution test
FAIL: 21_strings/substr.cc execution test
XPASS: 22_locale/collate_members_wchar_t.cc execution test
FAIL: 23_containers/bitset_ctor.cc execution test
FAIL: 23_containers/bitset_members.cc execution test
FAIL: 23_containers/list_modifiers.cc (test for excess errors)
WARNING: 23_containers/list_modifiers.cc compilation failed to produce executable
FAIL: 23_containers/map_operators.cc (test for excess errors)
FAIL: 23_containers/vector_element_access.cc execution test
FAIL: 26_numerics/c99_classification_macros_c.cc (test for excess errors)
FAIL: 27_io/ios_init.cc execution test
FAIL: 27_io/ios_members.cc execution test
I have not yet had time to investigate the runtime errors. Clearly it's
not a major symbol missing (those are resolved at link time) or otherwise
screwed (not all of the tests fail), but needs looking into soon.
The version script is below. Note that it WILL NOT WORK without a small
patch to ld, not yet in CVS.
I have also worked up a patch to provide --enable-symvers for
those of us experimenting with this functionality. It's a minor
tweak to src/Makefile.am, and the script below is assumed to be
"config/linker-map.gnu". There are minimal tests in the enable switch
for GNU ld; they also need improvement before going live.
The idea behind the tests and the name of the version script is that,
if someone wants to provide a script which does not require GNU ld, we
can drop that in config/linker-map.foo and --enable-symvers will DTRT.
(Also note that writing such a script should be easier than what I said it
would be earlier, since the person would not have to work from scratch.
Simply mangling and expanding the symbols in linker-map.gnu is all that
would be required. A simple matter of programming.)
Okay to commit the --enable patch? I plan to wait until my ld patches
are in.
What needs to happen next: we may need more symbols exported. We may
need fewer symbols exported. About 90% of the script below is guesswork.
In short, we need the C++ ABI experts to attack it.
Phil
## Linker script for GNU ld only.
##
## Copyright (C) 2002 Free Software Foundation, Inc.
##
## This file is part of the libstdc++ version 3 distribution.
##
## This file is part of the GNU ISO C++ Library. This library is free
## software; you can redistribute it and/or modify it under the
## terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along
## with this library; see the file COPYING. If not, write to the Free
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
## The symbol version here is a SWAG based on libgcc-std.ver.
GCC_3.1 {
global:
## Names inside the 'extern' block are human-readable (demangled) names;
## all but the last are terminated with a semicolon.
extern "C++"
{
std::[A-Za-z]* ;
std::__throw_* ;
std::__basic_file* ;
#std::__convert_to_* ;
std::__num_base* ;
std::__timepunct*
};
## Names not in an 'extern' block are mangled names. In the non-C cases,
## their demangled names are written above them, in a comment.
__cxa_* ;
__gxx_personality_v0 ;
__dynamic_cast ;
# DW.ref.__gxx_personality_v0 ; # I have no idea what this is.
######## these seem okay
## operator new(unsigned)
_Znwj ;
## operator delete(void*)
_ZdlPv ;
## operator new[](unsigned)
_Znaj ;
## operator delete[](void*)
_ZdaPv ;
######## hmmmmm
## std::_S_rb_tree_red
_ZSt14_S_rb_tree_red ;
## std::_S_rb_tree_black
_ZSt16_S_rb_tree_black ;
## std::__stl_threshold
_ZSt15__stl_threshold ;
## std::__stl_chunk_size
_ZSt16__stl_chunk_size ;
## VTT for std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >
_ZTTSt19basic_istringstreamIcSt11char_traitsIcESaIcEE ;
## VTT for std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >
_ZTTSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE ;
# this is a function, "void std::__convert_to_v(stuff)", and as such
# doesn't work well in the demangled section above
_ZSt14__convert_to_v* ;
# likewise for "std::_Setfill<char> std::setfill<char>(char)"
_ZSt7setfillIcESt8_SetfillIT_ES1_ ;
# likewise for "bool std::has_facet<std::ctype<char> >(std::locale const&)"
_ZSt9has_facetISt5ctypeIcEEbRKSt6locale ;
# likewise for "bool
# std::has_facet<std::num_put<char, std::ostreambuf_iterator<char,
# std::char_traits<char> > > >(std::locale const&)"
_ZSt9has_facetISt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEEEbRKSt6locale ;
# ditto for istreambuf_iterator
_ZSt9has_facetISt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEEbRKSt6locale ;
# ## vtable for std::logic_error
# _ZTVSt11logic_error ;
#
# ## vtable for std::exception
# _ZTVSt9exception ;
#
# ## vtable for __cxxabiv1::__class_type_info
# _ZTVN10__cxxabiv117__class_type_infoE ;
#
# ## vtable for __cxxabiv1::__si_class_type_info
# _ZTVN10__cxxabiv120__si_class_type_infoE ;
#
# ## vtable for __cxxabiv1::__vmi_class_type_info
# _ZTVN10__cxxabiv121__vmi_class_type_infoE ;
#
# gah, screw it, export /all/ the vtables in these namespaces, somebody
# smarter than me will have to figure this one out
_ZTVSt* ; _ZTVN10__cxxabiv1* ;
local:
* ;
};