This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] add c_locale_impl compatibility symbol
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 14 Oct 2002 23:17:52 -0500
- Subject: [v3] add c_locale_impl compatibility symbol
'make check-abi' wasn't catching the obvious codecvt_[c,w] size change, fixed.
In addtion, found that c_locale_impl size changed, so made a
compatible symbol for it.
tested x86/linux
2002-10-14 Benjamin Kosnik <bkoz@redhat.com>
* src/globals.cc (__gnu_cxx::c_locale_impl_compat): Add, alias to
c_locale_impl.
* testsuite/abi_check.cc (line_to_symbol_info): Collect size info.
* docs/html/abi.txt: Update.
Index: docs/html/abi.txt
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/abi.txt,v
retrieving revision 1.7
diff -c -p -r1.7 abi.txt
*** docs/html/abi.txt 9 Sep 2002 20:26:41 -0000 1.7
--- docs/html/abi.txt 15 Oct 2002 04:15:26 -0000
***************
*** 1,12 ****
! ===========================
!
! See http://gcc.gnu.org/ml/libstdc++/2002-07/msg00054.html for why this
! document exists, why it's incomplete, and what needs to be done still.
!
! ===========================
!
! 2002-09-06 Benjamin Kosnik
Description of the libstdc++ ABI.
--- 1,5 ----
! 2002-10-14 Benjamin Kosnik
Description of the libstdc++ ABI.
*************** II. Library ABI changes
*** 244,250 ****
The following will cause the library major version number to
increase, say from "libstdc++.so.3.0.4" to "libstdc++.so.4.0.0".
! - any g++ compiler ABI changes
- (anything) changing size of an exported symbol
--- 237,243 ----
The following will cause the library major version number to
increase, say from "libstdc++.so.3.0.4" to "libstdc++.so.4.0.0".
! - (anything) changing in the gcc/g++ compiler ABI
- (anything) changing size of an exported symbol
*************** increase, say from "libstdc++.so.3.0.4"
*** 256,262 ****
- (anything) deleting an exported symbol
! Note: adding an exported symbol, if it's in a new linker map name, is ok.
The following will cause the library revision version number to
increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1".
--- 249,262 ----
- (anything) deleting an exported symbol
! - (anything) changing the size, alignment, or layout of types
! specified in the C++ standard. These may not necessarily be
! instantiated or otherwise exported in the library binary, and
! include all the required locale facets, as well as things like
! std::basic_streambuf, et al.
!
! Note: adding an exported symbol, if it's in a new and dependent
! interface name, is ok.
The following will cause the library revision version number to
increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1".
*************** addition, all exported names are demangl
*** 331,347 ****
are checked to make sure they are the same size as the same object in
the baseline.
! In the future, more tests should be added. In particular, vtable
! information, offsets of data members in class objects, and other
! layout information should be checked.
! It should be possible to use sizeof, alignof, and offset to compute
offsets for each structure and type in the standard library, saving to
! another datafile. Then, compute this for new binaries, and look for
! differences.
Another approach might be to use the -fdump-class-hierarchy flag to
! get information.
(See g++/7470 on how this was used to find bugs.)
Perhaps there are other C++ ABI checkers. If so, please notify
--- 331,350 ----
are checked to make sure they are the same size as the same object in
the baseline.
! This dataset is insufficient, yet a start. Also needed is a
! comprehensive check for all user-visible types part of the standard
! library for sizeof() and alignof() changes.
! Verifying compatible layouts of objects is not even attempted. It
! should be possible to use sizeof, alignof, and offsetof to compute
offsets for each structure and type in the standard library, saving to
! another datafile. Then, compute this in a similar way for new
! binaries, and look for differences.
Another approach might be to use the -fdump-class-hierarchy flag to
! get information. However, currently this approach gives insufficient
! data for use in library testing, as class data members, their offsets,
! and other detailed data is not displayed with this flag.
(See g++/7470 on how this was used to find bugs.)
Perhaps there are other C++ ABI checkers. If so, please notify
Index: src/globals.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/globals.cc,v
retrieving revision 1.11
diff -c -p -r1.11 globals.cc
*** src/globals.cc 11 Oct 2002 21:10:09 -0000 1.11
--- src/globals.cc 15 Oct 2002 04:15:27 -0000
*************** namespace __gnu_cxx
*** 48,53 ****
--- 48,62 ----
{
using namespace std;
+ typedef char fake_facet_name[sizeof(char*)]
+ __attribute__ ((aligned(__alignof__(char*))));
+ fake_facet_name facet_name[6 + _GLIBCPP_NUM_CATEGORIES];
+
+ typedef char fake_locale_Impl[sizeof(locale::_Impl)]
+ __attribute__ ((aligned(__alignof__(locale::_Impl))));
+ fake_locale_Impl c_locale_impl;
+
+
// NB: The asm directives renames these non-exported, namespace
// __gnu_cxx symbols into the mistakenly exported, namespace std
// symbols in GLIBCPP_3.2.
*************** namespace __gnu_cxx
*** 61,78 ****
fake_locale c_locale;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8c_localeE, _ZSt8c_locale, GLIBCPP_3.2)
! typedef char fake_locale_Impl[sizeof(locale::_Impl)]
! __attribute__ ((aligned(__alignof__(locale::_Impl))));
! fake_locale_Impl c_locale_impl;
! _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13c_locale_implE, _ZSt13c_locale_impl, GLIBCPP_3.2)
typedef char fake_facet_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS];
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9facet_vecE, _ZSt9facet_vec, GLIBCPP_3.2)
-
- typedef char fake_facet_name[sizeof(char*)]
- __attribute__ ((aligned(__alignof__(char*))));
- fake_facet_name facet_name[6 + _GLIBCPP_NUM_CATEGORIES];
typedef char fake_ctype_c[sizeof(std::ctype<char>)]
__attribute__ ((aligned(__alignof__(std::ctype<char>))));
--- 70,88 ----
fake_locale c_locale;
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8c_localeE, _ZSt8c_locale, GLIBCPP_3.2)
! // GLIBCXX_ABI > 5 will not need this symbol at all.
! // It's here just as a placeholder, as the size of this exported
! // object changed. The new symbol is not exported.
! const int o = sizeof(locale::_Impl) - sizeof(char*[_GLIBCPP_NUM_CATEGORIES]);
! typedef char fake_locale_Impl_compat[o]
! __attribute__ ((aligned(__alignof__(o))));
! fake_locale_Impl_compat c_locale_impl_compat;
! _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx20c_locale_impl_compatE, _ZSt13c_locale_impl, GLIBCPP_3.2)
!
typedef char fake_facet_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS];
_GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9facet_vecE, _ZSt9facet_vec, GLIBCPP_3.2)
typedef char fake_ctype_c[sizeof(std::ctype<char>)]
__attribute__ ((aligned(__alignof__(std::ctype<char>))));
Index: testsuite/abi_check.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/abi_check.cc,v
retrieving revision 1.8
diff -c -p -r1.8 abi_check.cc
*** testsuite/abi_check.cc 13 Oct 2002 04:46:57 -0000 1.8
--- testsuite/abi_check.cc 15 Oct 2002 04:15:27 -0000
*************** line_to_symbol_info(std::string& input,
*** 191,197 ****
istringstream iss(size);
int x;
iss >> x;
! if (iss.good())
output.size = x;
input.erase(input.begin(), input.begin() + n + 1);
}
--- 191,197 ----
istringstream iss(size);
int x;
iss >> x;
! if (!iss.fail())
output.size = x;
input.erase(input.begin(), input.begin() + n + 1);
}