On Fri, Jun 6, 2014 at 3:16 PM, Marc Glisse <[email protected]> wrote:
> Hello,
>
> here is a new try on adding __float128 typeinfo to libsupc++. The front-end
> part is based on the discussion with Jason yesterday. The libstdc++ part is
> copied from:
> https://gcc.gnu.org/ml/libstdc++/2014-04/msg00077.html
> (which wasn't reviewed), but I changed the testsuite.
>
> Michael will likely need to make some adjustments to his __float128 patch,
> but I believe it will only be a small configure tweak.
>
> Ramana, does it look safe for ARM? By the way, do you want to remove the
> XFmode defined in arm-modes.def and apparently unused?
Thanks for this though I know Tejas is actually trying to fix AArch64
first and then we'll move on to ARM for cleaning up all these types -
as you realize it's quite a chunky project.
A patch to remove XFmode is pre-approved. I have no idea why this is
in here. Archeaology shows this came in
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72440
and with a FIXME:
I'll try and have a look at this patch later today or over the weekend
to see if it doesn't affect ARM / AArch64.
regards
Ramana
>
> Bootstrap+testsuite on x86_64-linux-gnu. I manually checked that
> libstdc++.{a,so} gained exactly the symbols related to typeinfo for
> __float128.
>
> abi_check is broken before my patch (134 incompatible symbols). After it,
> the number of added symbols increases by 7, but the number of incompatible
> symbols remains the same, so I take it as a pass.
>
> 2014-06-06 Marc Glisse <[email protected]>
>
> PR libstdc++/43622
> gcc/cp/
> * rtti.c (emit_support_tinfos): Handle __float128.
> libstdc++-v3/
> * config/abi/pre/float128.ver: New file.
> * configure.ac: Use float128.ver when relevant.
> * configure: Regenerate.
> * testsuite/util/testsuite_abi.cc (check_version): Accept new
> CXXABI_FLOAT128_1.3.9 version.
>
> --
> Marc Glisse
> Index: gcc/cp/rtti.c
> ===================================================================
> --- gcc/cp/rtti.c (revision 211311)
> +++ gcc/cp/rtti.c (working copy)
> @@ -1540,20 +1540,31 @@ emit_support_tinfos (void)
> /*tag_scope=*/ts_current, false);
> pop_abi_namespace ();
> if (!COMPLETE_TYPE_P (bltn_type))
> return;
> dtor = CLASSTYPE_DESTRUCTORS (bltn_type);
> if (!dtor || DECL_EXTERNAL (dtor))
> return;
> doing_runtime = 1;
> for (ix = 0; fundamentals[ix]; ix++)
> emit_support_tinfo_1 (*fundamentals[ix]);
> +
> + /* Search for an extra floating point type like __float128. */
> + for (enum machine_mode mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
> + mode != VOIDmode;
> + mode = GET_MODE_WIDER_MODE (mode))
> + {
> + tree type = c_common_type_for_mode (mode, false);
> + if (type && type != float_type_node && type != double_type_node
> + && type != long_double_type_node)
> + emit_support_tinfo_1 (type);
> + }
> }
>
> /* Finish a type info decl. DECL_PTR is a pointer to an unemitted
> tinfo decl. Determine whether it needs emitting, and if so
> generate the initializer. */
>
> bool
> emit_tinfo_decl (tree decl)
> {
> tree type = TREE_TYPE (DECL_NAME (decl));
> Index: libstdc++-v3/config/abi/pre/float128.ver
> ===================================================================
> --- libstdc++-v3/config/abi/pre/float128.ver (revision 0)
> +++ libstdc++-v3/config/abi/pre/float128.ver (working copy)
> @@ -0,0 +1,10 @@
> +# Appended to version file.
> +
> +CXXABI_FLOAT128_1.3.9 {
> +
> + # typeinfo and typeinfo name for __float128
> + _ZT[IS]g;
> + _ZT[IS]Pg;
> + _ZT[IS]PKg;
> +
> +};
> Index: libstdc++-v3/configure
> ===================================================================
> --- libstdc++-v3/configure (revision 211311)
> +++ libstdc++-v3/configure (working copy)
> @@ -15698,20 +15698,23 @@ $as_echo "#define _GLIBCXX_USE_FLOAT128
> $as_echo "$enable_float128" >&6; }
> rm -f conftest*
>
> ac_ext=c
> ac_cpp='$CPP $CPPFLAGS'
> ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
> ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS
> conftest.$ac_ext $LIBS >&5'
> ac_compiler_gnu=$ac_cv_c_compiler_gnu
>
>
> +if test "$enable_float128" = yes; then
> + port_specific_symbol_files="$port_specific_symbol_files
> \$(top_srcdir)/config/abi/pre/float128.ver"
> +fi
>
> # Checks for compiler support that doesn't require linking.
>
> # All these tests are for C++; save the language and the compiler flags.
> # The CXXFLAGS thing is suspicious, but based on similar bits previously
> # found in GLIBCXX_CONFIGURE.
>
> ac_ext=cpp
> ac_cpp='$CXXCPP $CPPFLAGS'
> ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
> Index: libstdc++-v3/configure.ac
> ===================================================================
> --- libstdc++-v3/configure.ac (revision 211311)
> +++ libstdc++-v3/configure.ac (working copy)
> @@ -146,20 +146,23 @@ GLIBCXX_ENABLE_HOSTED
> # Enable descriptive messages to standard output on termination.
> GLIBCXX_ENABLE_VERBOSE
>
> # Enable compiler support that doesn't require linking.
> GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
> GLIBCXX_ENABLE_PCH($is_hosted)
> GLIBCXX_ENABLE_THREADS
> GLIBCXX_ENABLE_ATOMIC_BUILTINS
> GLIBCXX_ENABLE_DECIMAL_FLOAT
> GLIBCXX_ENABLE_INT128_FLOAT128
> +if test "$enable_float128" = yes; then
> + port_specific_symbol_files="$port_specific_symbol_files
> \$(top_srcdir)/config/abi/pre/float128.ver"
> +fi
>
> # Checks for compiler support that doesn't require linking.
> GLIBCXX_CHECK_COMPILER_FEATURES
>
> # Enable all the variable C++ runtime options that don't require linking.
> GLIBCXX_ENABLE_CSTDIO
> GLIBCXX_ENABLE_CLOCALE
> GLIBCXX_ENABLE_ALLOCATOR
> GLIBCXX_ENABLE_CHEADERS($c_model) dnl c_model from configure.host
> GLIBCXX_ENABLE_LONG_LONG([yes])
> Index: libstdc++-v3/testsuite/util/testsuite_abi.cc
> ===================================================================
> --- libstdc++-v3/testsuite/util/testsuite_abi.cc (revision 211311)
> +++ libstdc++-v3/testsuite/util/testsuite_abi.cc (working copy)
> @@ -205,48 +205,51 @@ check_version(symbol& test, bool added)
> known_versions.push_back("CXXABI_LDBL_1.3");
> known_versions.push_back("CXXABI_1.3.1");
> 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_1.3.5");
> known_versions.push_back("CXXABI_1.3.6");
> known_versions.push_back("CXXABI_1.3.7");
> known_versions.push_back("CXXABI_1.3.8");
> known_versions.push_back("CXXABI_1.3.9");
> + known_versions.push_back("CXXABI_FLOAT128_1.3.9");
> known_versions.push_back("CXXABI_TM_1");
> }
> compat_list::iterator begin = known_versions.begin();
> compat_list::iterator end = known_versions.end();
>
> // Check for compatible version.
> if (test.version_name.size())
> {
> compat_list::iterator it1 = find(begin, end, test.version_name);
> compat_list::iterator it2 = find(begin, end, test.name);
> if (it1 != end)
> test.version_status = symbol::compatible;
> else
> test.version_status = symbol::incompatible;
>
> // Check that added symbols are added in the latest pre-release
> version.
> bool latestp = (test.version_name == "GLIBCXX_3.4.21"
> || test.version_name == "CXXABI_1.3.9"
> + || test.version_name == "CXXABI_FLOAT128_1.3.9"
> || test.version_name == "CXXABI_TM_1");
> if (added && !latestp)
> test.version_status = symbol::incompatible;
>
> // Check that long double compatibility symbols demangled as
> - // __float128 are put into some _LDBL_ version name.
> + // __float128 and regular __float128 symbols are put into some _LDBL_
> + // or _FLOAT128_ version name.
> if (added && test.demangled_name.find("__float128") !=
> std::string::npos)
> {
> - // Has to be in _LDBL_ version name.
> - if (test.version_name.find("_LDBL_") == std::string::npos)
> + if (test.version_name.find("_LDBL_") == std::string::npos
> + && test.version_name.find("_FLOAT128_") == std::string::npos)
> test.version_status = symbol::incompatible;
> }
>
> // Check for weak label.
> if (it1 == end && it2 == end)
> test.version_status = symbol::incompatible;
>
> // Check that
> // GLIBCXX_3.4
> // GLIBCXX_3.4.5
>