[trans-mem] use -fabi-version=4 in libitm

Aldy Hernandez aldyh@redhat.com
Mon Apr 19 17:48:00 GMT 2010


Hi folks.

Previously we had an always_inline hack to avoid demangling confusion
wrt vectors in libitm.  Now with vector demangling fixed with
-fabi-version=4, we can build libitm with it and avoid the kludge.

However, when I build libitm with -fabi-version=4, abi_check fails in
the libstdc++-v3 testsuite because __cxa_tm_cleanup has a different abi
revision.  I have fixed this by adding CXXABI_TM_1 to the testsuite
checker.  (Is this the right approach?)

OK for branch?

-----------------------

libitm/
	* Makefile.am (abi_version): New.
	(AM_CXXFLAGS): Pass abi_version.
	* Makefile.in: Regenerate.
	* config/x86/unaligned.h: Remove always_inline kludge for vectors.

/
	* libstdc++-v3/testsuite/util/testsuite_abi.cc (check_version):
	Add CXXABI_TM_1.

Index: libitm/Makefile.in
===================================================================
--- libitm/Makefile.in	(revision 158257)
+++ libitm/Makefile.in	(working copy)
@@ -333,12 +333,13 @@ top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 SUBDIRS = testsuite
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+abi_version = -fabi-version=4
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
 fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/finclude
 libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
 AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
-AM_CXXFLAGS = -std=gnu++0x -fno-rtti $(XCFLAGS)
+AM_CXXFLAGS = -std=gnu++0x -fno-rtti $(XCFLAGS) $(abi_version)
 AM_CCASFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
 toolexeclib_LTLIBRARIES = libitm.la
Index: libitm/config/x86/unaligned.h
===================================================================
--- libitm/config/x86/unaligned.h	(revision 158257)
+++ libitm/config/x86/unaligned.h	(working copy)
@@ -32,10 +32,6 @@
 
 namespace GTM HIDDEN {
 
-// ??? C++ currently has ambiguous name mangling, with __m128 and __m256
-// mangling to the same thing.  "Fix" this by forcing these inline
-// functions to be always inline.
-
 template<>
 inline uint32_t
 unaligned_load2<uint32_t>(const gtm_cacheline *c1,
@@ -121,14 +117,14 @@ template<>
 
 // Expand the unaligned SSE move instructions.
 template<>
-inline _ITM_TYPE_M128 ALWAYS_INLINE
+inline _ITM_TYPE_M128
 unaligned_load<_ITM_TYPE_M128>(const void *t)
 {
   return _mm_loadu_ps (static_cast<const float *>(t));
 }
 
 template<>
-inline void ALWAYS_INLINE
+inline void
 unaligned_store<_ITM_TYPE_M128>(void *t, _ITM_TYPE_M128 val)
 {
   _mm_storeu_ps (static_cast<float *>(t), val);
@@ -143,14 +139,14 @@ template<>
   { };
 
 template<>
-inline _ITM_TYPE_M256 ALWAYS_INLINE
+inline _ITM_TYPE_M256
 unaligned_load<_ITM_TYPE_M256>(const void *t)
 {
   return _mm256_loadu_ps (static_cast<const float *>(t));
 }
 
 template<>
-inline void ALWAYS_INLINE
+inline void
 unaligned_store<_ITM_TYPE_M256>(void *t, _ITM_TYPE_M256 val)
 {
   _mm256_storeu_ps (static_cast<float *>(t), val);
@@ -160,7 +156,7 @@ unaligned_store<_ITM_TYPE_M256>(void *t,
 #ifdef __XOP__
 # define HAVE_ARCH_REALIGN_M128I 1
 extern const __v16qi GTM_vpperm_shift[16];
-inline __m128i ALWAYS_INLINE
+inline __m128i
 realign_m128i (__m128i lo, __m128i hi, unsigned byte_count)
 {
   return _mm_perm_epi8 (lo, hi, GTM_vpperm_shift[byte_count]);
@@ -168,7 +164,7 @@ realign_m128i (__m128i lo, __m128i hi, u
 #elif defined(__AVX__)
 # define HAVE_ARCH_REALIGN_M128I 1
 extern "C" const uint64_t GTM_vpalignr_table[16];
-inline __m128i ALWAYS_INLINE
+inline __m128i
 realign_m128i (__m128i lo, __m128i hi, unsigned byte_count)
 {
   register __m128i xmm0 __asm__("xmm0") = hi;
@@ -180,7 +176,7 @@ realign_m128i (__m128i lo, __m128i hi, u
 #elif defined(__SSSE3__)
 # define HAVE_ARCH_REALIGN_M128I 1
 extern "C" const uint64_t GTM_palignr_table[16];
-inline __m128i ALWAYS_INLINE
+inline __m128i
 realign_m128i (__m128i lo, __m128i hi, unsigned byte_count)
 {
   register __m128i xmm0 __asm__("xmm0") = hi;
@@ -192,7 +188,7 @@ realign_m128i (__m128i lo, __m128i hi, u
 #elif defined(__SSE2__)
 # define HAVE_ARCH_REALIGN_M128I 1
 extern "C" const char GTM_pshift_table[16 * 16];
-inline __m128i ALWAYS_INLINE
+inline __m128i
 realign_m128i (__m128i lo, __m128i hi, unsigned byte_count)
 {
   register __m128i xmm0 __asm__("xmm0") = lo;
@@ -205,7 +201,7 @@ realign_m128i (__m128i lo, __m128i hi, u
 
 #ifdef HAVE_ARCH_REALIGN_M128I
 template<>
-inline _ITM_TYPE_M128 ALWAYS_INLINE
+inline _ITM_TYPE_M128
 unaligned_load2<_ITM_TYPE_M128>(const gtm_cacheline *c1,
 				const gtm_cacheline *c2, size_t ofs)
 {
@@ -217,7 +213,7 @@ unaligned_load2<_ITM_TYPE_M128>(const gt
 
 #ifdef __AVX__
 template<>
-inline _ITM_TYPE_M256 ALWAYS_INLINE
+inline _ITM_TYPE_M256
 unaligned_load2<_ITM_TYPE_M256>(const gtm_cacheline *c1,
 				const gtm_cacheline *c2, size_t ofs)
 {
Index: libitm/Makefile.am
===================================================================
--- libitm/Makefile.am	(revision 158257)
+++ libitm/Makefile.am	(working copy)
@@ -6,6 +6,8 @@ SUBDIRS = testsuite
 ## May be used by toolexeclibdir.
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 
+abi_version = -fabi-version=4
+
 config_path = @config_path@
 search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir)
 
@@ -16,7 +18,7 @@ vpath % $(strip $(search_path))
 
 AM_CPPFLAGS = $(addprefix -I, $(search_path))
 AM_CFLAGS = $(XCFLAGS)
-AM_CXXFLAGS = -std=gnu++0x -fno-rtti $(XCFLAGS)
+AM_CXXFLAGS = -std=gnu++0x -fno-rtti $(XCFLAGS) $(abi_version)
 AM_CCASFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
 
Index: libstdc++-v3/testsuite/util/testsuite_abi.cc
===================================================================
--- libstdc++-v3/testsuite/util/testsuite_abi.cc	(revision 158257)
+++ libstdc++-v3/testsuite/util/testsuite_abi.cc	(working copy)
@@ -194,6 +194,7 @@ check_version(symbol& test, bool added)
       known_versions.push_back("CXXABI_1.3.2");
       known_versions.push_back("CXXABI_1.3.3");
       known_versions.push_back("CXXABI_1.3.4");
+      known_versions.push_back("CXXABI_TM_1");
       known_versions.push_back("CXXABI_LDBL_1.3");
     }
   compat_list::iterator begin = known_versions.begin();



More information about the Gcc-patches mailing list