[RFC PATCH] Optionally use -mlong-double-128 by default on {powerpc{,64},s390{,x},sparc,alpha}-linux

Jakub Jelinek jakub@redhat.com
Fri Jan 27 17:16:00 GMT 2006


Hi!

This is a preliminary patch for -mlong-double-128 as default on the
linux targets that are going to switch long double in glibc 2.4+.
The gcc side is only done for ppc ATM and I'd say it is not very
controversial, just adds a new configure option to select the default
and has a reasonable default value (when building against glibc 2.4+
uses TFmode long double, otherwise DFmode long double).

More controversial is the libstdc++-v3 side.  I think nobody wants to
change libstdc++.so's SONAME at this point (GCC 4.1), so what this patch
does is ensure one libstdc++.so.6 is backwards compatible with
-mlong-double-64 programs and libraries and also is compatible with
newly compiled -mlong-double-128 programs and libraries.
The patch below is unfinished, we need to find a solution for
money_get/money_put methods involving long double argument (as unlike
all other symbols, there is no exported corresponding routine with
double argument).

I'm pasting here what I wrote to Benjamin privately yesterday:

All I want to ensure is that one libstdc++.so.6 can be used with
older, -mlong-double-64, compiled/linked programs (and libraries)
and newer, -mlong-double-128 compiled/linked programs (and libraries),
though of course mixing libraries other than glibc libs and libstdc++.so.6
+ libgcc_s.so with different long double sizes together is user's problem.
Fortunately, at least find /usr/include -type f | xargs grep 'long double'
doesn't show too many hits outside of glibc/libstdc++ headers.

What we did in glibc is:
1) for most math functions, where we before used to export say
   asin@@GLIBC_2.0
   asinl@@GLIBC_2.0
   where the 2 were aliases or have the same behavior, as long double
   type was the same as double, we now export:
   asin@@GLIBC_2.0
   asinl@GLIBC_2.0      ! alias to asin@@GLIBC_2.0
   asinl@@GLIBC_2.4     ! new function, using 128-bit long double
   which means that older binaries/libraries (i.e. -mlong-double-64 ones)
   still work using the asinl@GLIBC_2.0, -mlong-double-128 ones use
   asinl@@GLIBC_2.4.  glibc actually also supports newly compiled/linked
   programs with -mlong-double-64, through __asm redirection in headers,
   essentially:
   extern long double asinl (long double x)
   #ifndef __LONG_DOUBLE_128__
   __asm ("asin")
   #endif
   ;
2) for other functions, like printf, we used to have:
   printf@@GLIBC_2.0
   and now have:
   printf@GLIBC_2.0     ! this one assumes long double is double
   __nldbl_printf@@GLIBC_2.4    ! alias to this
   printf@@GLIBC_2.4    ! this one assumes long double is 128-bit
   and again redirect magic in headers:
   extern int printf (const char *fmt, ...)
   #ifndef __LONG_DOUBLE_128__
   __asm ("__nldbl_printf")
   #endif
   ;
Now, libgcc, if built with -mlong-double-128, satisfies everybody,
both old and new apps.

For libstdc++.so, the header __asm redirect stuff just won't work,
C++ doesn't allow that.  But that's not that big deal, I expect
all distros that switch to glibc 2.4 will switch to 128-bit long double
and mass rebuild everything.  If someone wants to compile/link a
-mlong-double-64 program, he can use some compatibility compiler,
or even just a contemporary gcc configured with --without-long-double-128
installed in a separate prefix or something.

But, with shared libraries we need just one library with a given SONAME
that is backwards compatible, DT_RPATH hacks would just lead to extreme
insanity and wouldn't really work.
So, I want to do the symbol versioning part of 1) in libstdc++ too
(but don't do any header redirections).  So, if you on the architectures
in question build -mlong-double-64 (aka --without-long-double-128)
libstdc++, it will have the current exported symbols, but if you build
-mlong-double-128 libstdc++ (aka --with-long-double-128) then it
will have the currently exported symbols (just some of them maybe not
the default version) and a bunch of new @@GLIBCXX_LDBL_3.4 symbols
(the _LDBL middle part is in there, because gcc can be configured both
ways, so using @@GLIBCXX_3.4.8 or something similar wouldn't be right,
it is not in a timeline from older to newer gcc's, but administrator's
choice).

> As far as I can tell, you have presented two options.
>
> 1) mess with the linker script, in which case I don't understand why
> you are messing with double (ie d encodings) stuff at all,

We need to mess with linker script in any case, so that we have say:
in current libstdc++ as well as in newer --without-long-double-128
configured one:
_ZNSirsERd@@GLIBCXX_3.4
_ZNSirsERe@@GLIBCXX_3.4
and in --with-long-double-128 configured one:
_ZNSirsERd@@GLIBCXX_3.4
_ZNSirsERe@GLIBCXX_3.4  ! alias to _ZNSirsERd (both functions actually
                        ! do the same thing when double == long double)
_ZNSirsERe@@GLIBCXX_LDBL_3.4 ! this one uses 128-bit long double

The options were how to arrange for this to happen in the source.
As .symver _ZNSirsERd, _ZNSirsERd@@GLIBCXX_3.4 will not work right
with as/ld, we need to make sure the file uses some alias to
_ZNSirsERe, e.g. _GNSirsERe or anything other than _ZNSirsERe, and
then have .symver _GNSirsERe, _ZNSirsERe@@GLIBCXX_LDBL_3.4.
That can be done through 2), i.e. pretend as allows
.symver _ZNSirsERe, _ZNSirsERe@@GLIBCXX_3.4

And I believe:
*invoke_as:
%{!S:-o %{DPIC:%g.sv |
 glibcxx_asver %g.sv %g.se %|.s ;:%|.s } |
 as %(asm_options) %|.s %A }

and then src/Makefile.in ensures all sources are compiled with
-specs=dir/glibcxx_specs -B dir/
where dir/glibcxx_asver is a sh + sed script that does the dirty
job (seds the input file ($1) into sed rules file ($2) and then
invokes
if [ x$3 = x- ]; then
  sed -f $2 $1
else
  sed -f $2 $1 > $3
fi
) show do the trick.
Or we need through some #defines ensure G++ mangles the things
differently, e.g. compatibility.cc uses crap for this like:
#define istreambuf_iterator istreambuf_iteratorXX
#define basic_fstream basic_fstreamXX
#define basic_ifstream basic_ifstreamXX
#define basic_ofstream basic_ofstreamXX
#define _M_copy(a, b, c) _M_copyXX(a, b, c)
#define _M_move(a, b, c) _M_moveXX(a, b, c)
#define _M_assign(a, b, c) _M_assignXX(a, b, c)
#define _M_disjunct(a) _M_disjunctXX(a)
#define _M_check_length(a, b, c) _M_check_lengthXX(a, b, c)
#define _M_set_length_and_sharable(a) _M_set_length_and_sharableXX(a)
#define ignore ignoreXX
#define eq eqXX

2006-01-27  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/linux.h [TARGET_DEFAULT_LONG_DOUBLE_128]
	(RS6000_DEFAULT_LONG_DOUBLE_SIZE): Define to 128.
	* config/rs6000/linux64.h [TARGET_DEFAULT_LONG_DOUBLE_128]
	(RS6000_DEFAULT_LONG_DOUBLE_SIZE): Define to 128.
	* configure.ac: Add --with{out}-long-double-128 configure option.
	(TARGET_DEFAULT_LONG_DOUBLE_128): New test.
	* configure: Rebuilt.
	* config.in: Rebuilt.
libstdc++-v3/
	* configure.ac (_GLIBCXX_LONG_DOUBLE_COMPAT): New check.
	If true, set also port_specific_symbol_files and create
	as_symver_specs.
	(SYMVER_CXXFLAGS): New substituted var.
	* configure: Rebuilt.
	* config.h.in: Rebuilt.
	* scripts/as_symver_filter: New file.
	* config/os/gnu-linux/ldbl-extra.ver: New file.
	* src/Makefile.am (libstdc++-symbol.ver): Append instead of
	insert in the middle if port specific symbol file requests it.
	(AM_CXXFLAGS): Add SYMVER_CXXFLAGS.
	* src/Makefile.in: Rebuilt.
	* src/complex_io.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Add compatibility
	symbols.
	* src/istream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* src/limits.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* src/locale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* src/ostream-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* src/wlocale-inst.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* config/locale/generic/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]:
	Likewise.
	* config/locale/gnu/c_locale.cc [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* libmath/stubs.c [_GLIBCXX_LONG_DOUBLE_COMPAT]: Likewise.
	* libsupc++/Makefile.am (sources): Remove tinfo2.cc.
	(libsupc___la_SOURCES): Add it here.
	(libsupc__convenience_la_SOURCES): Add tinfo3.cc.
	(AM_CXXFLAGS): Add SYMVER_CXXFLAGS.
	* libsupc++/Makefile.in: Rebuilt.
	* libsupc++/tinfo3.cc: New file.

--- gcc/config/rs6000/linux.h.jj	2006-01-25 12:38:04.000000000 +0100
+++ gcc/config/rs6000/linux.h	2006-01-25 13:12:58.000000000 +0100
@@ -1,7 +1,7 @@
 /* Definitions of target machine for GNU compiler,
    for PowerPC machines running Linux.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+   2006  Free Software Foundation, Inc.
    Contributed by Michael Meissner (meissner@cygnus.com).
 
    This file is part of GCC.
@@ -121,3 +121,7 @@
 
 #define POWERPC_LINUX
 
+/* ppc linux has 128-bit long double support in glibc 2.4 and later.  */
+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
+#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
+#endif
--- gcc/config/rs6000/linux64.h.jj	2006-01-25 12:38:04.000000000 +0100
+++ gcc/config/rs6000/linux64.h	2006-01-25 13:12:05.000000000 +0100
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler,
    for 64 bit PowerPC linux.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -571,3 +571,7 @@ while (0)
 
 #define POWERPC_LINUX
 
+/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later.  */
+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
+#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
+#endif
--- gcc/configure.ac.jj	2006-01-25 12:25:32.000000000 +0100
+++ gcc/configure.ac	2006-01-25 13:13:58.000000000 +0100
@@ -3118,6 +3118,39 @@ if test x$gcc_cv_libc_provides_ssp = xye
 	    [Define if your target C library provides stack protector support])
 fi
 
+# Check if TFmode long double should be used by default or not.
+# Some glibc targets used DFmode long double, but with glibc 2.4
+# and later they can use TFmode.
+case "$target" in
+  powerpc*-*-*gnu* | \
+  sparc*-*-linux* | \
+  s390*-*-linux* | \
+  alpha*-*-linux*)
+    AC_ARG_WITH(long-double-128,
+[  --with-long-double-128  Use 128-bit long double by default.],
+      gcc_cv_target_ldbl128="$with_long_double_128",
+      [gcc_cv_target_ldbl128=no
+      if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
+	if test "x$with_sysroot" = x; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
+	elif test "x$with_sysroot" = xyes; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
+	else
+	  glibc_header_dir="${with_sysroot}/usr/include"
+	fi
+      else
+	glibc_header_dir=/usr/include
+      fi
+      grep '^[ 	]*#[ 	]*define[ 	][ 	]*__LONG_DOUBLE_MATH_OPTIONAL' \
+        $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
+      && gcc_cv_target_ldbl128=yes])
+    ;;
+esac
+if test x$gcc_cv_target_ldbl128 = xyes; then
+  AC_DEFINE(TARGET_DEFAULT_LONG_DOUBLE_128, 1,
+	    [Define if TFmode long double should be the default])
+fi
+
 # Find out what GC implementation we want, or may, use.
 AC_ARG_WITH(gc,
 [  --with-gc={page,zone}   choose the garbage collection mechanism to use
--- gcc/configure.jj	2006-01-25 12:25:32.000000000 +0100
+++ gcc/configure	2006-01-25 13:14:12.000000000 +0100
@@ -931,6 +931,7 @@ Optional Packages:
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
   --with-system-libunwind use installed libunwind
+  --with-long-double-128  Use 128-bit long double by default.
   --with-gc={page,zone}   choose the garbage collection mechanism to use
                           with the compiler
   --with-system-zlib      use installed libz
@@ -7492,7 +7493,7 @@ if test "${gcc_cv_prog_makeinfo_modern+s
 else
     ac_prog_version=`$MAKEINFO --version 2>&1 |
                    sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
-  echo "configure:7495: version of makeinfo is $ac_prog_version" >&5
+  echo "configure:7496: version of makeinfo is $ac_prog_version" >&5
   case $ac_prog_version in
     '')     gcc_cv_prog_makeinfo_modern=no;;
     4.[2-9]*)
@@ -16201,6 +16202,46 @@ _ACEOF
 
 fi
 
+# Check if TFmode long double should be used by default or not.
+# Some glibc targets used DFmode long double, but with glibc 2.4
+# and later they can use TFmode.
+case "$target" in
+  powerpc*-*-*gnu* | \
+  sparc*-*-linux* | \
+  s390*-*-linux* | \
+  alpha*-*-linux*)
+
+# Check whether --with-long-double-128 or --without-long-double-128 was given.
+if test "${with_long_double_128+set}" = set; then
+  withval="$with_long_double_128"
+  gcc_cv_target_ldbl128="$with_long_double_128"
+else
+  gcc_cv_target_ldbl128=no
+      if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
+	if test "x$with_sysroot" = x; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
+	elif test "x$with_sysroot" = xyes; then
+	  glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
+	else
+	  glibc_header_dir="${with_sysroot}/usr/include"
+	fi
+      else
+	glibc_header_dir=/usr/include
+      fi
+      grep '^ 	*#[ 	]*define[ 	][ 	]*__LONG_DOUBLE_MATH_OPTIONAL' \
+        $glibc_header_dir/bits/wordsize.h > /dev/null 2>&1 \
+      && gcc_cv_target_ldbl128=yes
+fi;
+    ;;
+esac
+if test x$gcc_cv_target_ldbl128 = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TARGET_DEFAULT_LONG_DOUBLE_128 1
+_ACEOF
+
+fi
+
 # Find out what GC implementation we want, or may, use.
 
 # Check whether --with-gc or --without-gc was given.
--- gcc/config.in.jj	2006-01-07 18:33:59.000000000 +0100
+++ gcc/config.in	2006-01-25 13:07:00.000000000 +0100
@@ -1277,6 +1277,12 @@
 #endif
 
 
+/* Define if TFmode long double should be the default */
+#ifndef USED_FOR_TARGET
+#undef TARGET_DEFAULT_LONG_DOUBLE_128
+#endif
+
+
 /* Define if your target C library provides stack protector support */
 #ifndef USED_FOR_TARGET
 #undef TARGET_LIBC_PROVIDES_SSP
--- libstdc++-v3/libmath/stubs.c.jj	2005-11-12 18:07:17.000000000 +0100
+++ libstdc++-v3/libmath/stubs.c	2006-01-27 17:31:23.000000000 +0100
@@ -453,3 +453,87 @@ tanhl(long double x)
   return tanh((double) x);
 }
 #endif
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_MATHL_WRAPPER0(name, argdecl, args) \
+double								\
+__ ## name ## l_wrapper argdecl					\
+{								\
+  return name args;						\
+}								\
+asm (".symver __ " #name "l_wrapper, " #name "l@GLIBCXX_3.4")
+#define _GLIBCXX_MATHL_WRAPPER(name) \
+  _GLIBCXX_MATHL_WRAPPER0 (name, (double x), (x))
+#define _GLIBCXX_MATHL_WRAPPER2(name) \
+  _GLIBCXX_MATHL_WRAPPER0 (name, (double x, double y), (x, y))
+
+#ifdef HAVE_ACOSL
+_GLIBCXX_MATHL_WRAPPER (acos);
+#endif
+#ifdef HAVE_ASINL
+_GLIBCXX_MATHL_WRAPPER (asin);
+#endif
+#ifdef HAVE_ATAN2L
+_GLIBCXX_MATHL_WRAPPER2 (atan2);
+#endif
+#ifdef HAVE_ATANL
+_GLIBCXX_MATHL_WRAPPER (atan);
+#endif
+#ifdef HAVE_CEILL
+_GLIBCXX_MATHL_WRAPPER (ceil);
+#endif
+#ifdef HAVE_COSHL
+_GLIBCXX_MATHL_WRAPPER (cosh);
+#endif
+#ifdef HAVE_COSL
+_GLIBCXX_MATHL_WRAPPER (cos);
+#endif
+#ifdef HAVE_EXPL
+_GLIBCXX_MATHL_WRAPPER (exp);
+#endif
+#ifdef HAVE_FLOORL
+_GLIBCXX_MATHL_WRAPPER (floor);
+#endif
+#ifdef HAVE_FMODL
+_GLIBCXX_MATHL_WRAPPER2 (fmod);
+#endif
+#ifdef HAVE_FREXPL
+_GLIBCXX_MATHL_WRAPPER0 (frexp, (double x, int *y), (x, y));
+#endif
+#ifdef HAVE_HYPOTL
+_GLIBCXX_MATHL_WRAPPER (hypot);
+#endif
+#ifdef HAVE_LDEXPL
+_GLIBCXX_MATHL_WRAPPER0 (ldexp, (double x, int y), (x, y));
+#endif
+#ifdef HAVE_LOG10L
+_GLIBCXX_MATHL_WRAPPER (log10);
+#endif
+#ifdef HAVE_LOGL
+_GLIBCXX_MATHL_WRAPPER (log);
+#endif
+#ifdef HAVE_MODL
+_GLIBCXX_MATHL_WRAPPER0 (mod, (double x, double *y), (x, y));
+#endif
+#ifdef HAVE_POWL
+_GLIBCXX_MATHL_WRAPPER2 (pow);
+#endif
+#ifdef HAVE_SINHL
+_GLIBCXX_MATHL_WRAPPER (sinh);
+#endif
+#ifdef HAVE_SINL
+_GLIBCXX_MATHL_WRAPPER (sin);
+#endif
+#ifdef HAVE_SQRTL
+_GLIBCXX_MATHL_WRAPPER (sqrt);
+#endif
+#ifdef HAVE_TANHL
+_GLIBCXX_MATHL_WRAPPER (tanh);
+#endif
+#ifdef HAVE_TANL
+_GLIBCXX_MATHL_WRAPPER (tan);
+#endif
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/libsupc++/Makefile.am.jj	2006-01-07 18:34:01.000000000 +0100
+++ libstdc++-v3/libsupc++/Makefile.am	2006-01-27 17:41:43.000000000 +0100
@@ -65,12 +65,11 @@ sources = \
 	new_opvnt.cc \
 	pure.cc \
 	tinfo.cc \
-	tinfo2.cc \
 	vec.cc \
 	vterminate.cc
 
-libsupc___la_SOURCES = $(sources) $(c_sources)
-libsupc__convenience_la_SOURCES = $(sources) $(c_sources)
+libsupc___la_SOURCES = $(sources) tinfo2.cc $(c_sources)
+libsupc__convenience_la_SOURCES = $(sources) tinfo3.cc $(c_sources)
 
 glibcxxinstalldir = $(gxx_include_dir)
 glibcxxinstall_HEADERS = $(headers)
@@ -85,7 +84,8 @@ AM_CXXFLAGS = \
 	$(LIBSUPCXX_PICFLAGS) \
 	$(WARN_CXXFLAGS) \
 	$(OPTIMIZE_CXXFLAGS) \
-	$(CONFIG_CXXFLAGS)
+	$(CONFIG_CXXFLAGS) \
+	$(SYMVER_CXXFLAGS)
 
 AM_MAKEFLAGS = \
 	"gxx_include_dir=$(gxx_include_dir)"
--- libstdc++-v3/libsupc++/Makefile.in.jj	2006-01-17 10:46:51.000000000 +0100
+++ libstdc++-v3/libsupc++/Makefile.in	2006-01-27 17:41:51.000000000 +0100
@@ -69,16 +69,16 @@ am__libsupc___la_SOURCES_DIST = del_op.c
 	eh_personality.cc eh_term_handler.cc eh_terminate.cc \
 	eh_throw.cc eh_type.cc eh_unex_handler.cc guard.cc \
 	new_handler.cc new_op.cc new_opnt.cc new_opv.cc new_opvnt.cc \
-	pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc cp-demangle.c
+	pure.cc tinfo.cc vec.cc vterminate.cc tinfo2.cc cp-demangle.c
 am__objects_1 = del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo \
 	eh_alloc.lo eh_arm.lo eh_aux_runtime.lo eh_call.lo eh_catch.lo \
 	eh_exception.lo eh_globals.lo eh_personality.lo \
 	eh_term_handler.lo eh_terminate.lo eh_throw.lo eh_type.lo \
 	eh_unex_handler.lo guard.lo new_handler.lo new_op.lo \
-	new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo tinfo2.lo \
-	vec.lo vterminate.lo
+	new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo vec.lo \
+	vterminate.lo
 @GLIBCXX_HOSTED_TRUE@am__objects_2 = cp-demangle.lo
-am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2)
+am_libsupc___la_OBJECTS = $(am__objects_1) tinfo2.lo $(am__objects_2)
 libsupc___la_OBJECTS = $(am_libsupc___la_OBJECTS)
 libsupc__convenience_la_LIBADD =
 am__libsupc__convenience_la_SOURCES_DIST = del_op.cc del_opnt.cc \
@@ -87,9 +87,10 @@ am__libsupc__convenience_la_SOURCES_DIST
 	eh_globals.cc eh_personality.cc eh_term_handler.cc \
 	eh_terminate.cc eh_throw.cc eh_type.cc eh_unex_handler.cc \
 	guard.cc new_handler.cc new_op.cc new_opnt.cc new_opv.cc \
-	new_opvnt.cc pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc \
+	new_opvnt.cc pure.cc tinfo.cc vec.cc vterminate.cc tinfo3.cc \
 	cp-demangle.c
-am_libsupc__convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2)
+am_libsupc__convenience_la_OBJECTS = $(am__objects_1) tinfo3.lo \
+	$(am__objects_2)
 libsupc__convenience_la_OBJECTS =  \
 	$(am_libsupc__convenience_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -207,6 +208,7 @@ SECTION_LDFLAGS = @SECTION_LDFLAGS@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+SYMVER_CXXFLAGS = @SYMVER_CXXFLAGS@
 SYMVER_MAP = @SYMVER_MAP@
 TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
 USE_NLS = @USE_NLS@
@@ -333,12 +335,11 @@ sources = \
 	new_opvnt.cc \
 	pure.cc \
 	tinfo.cc \
-	tinfo2.cc \
 	vec.cc \
 	vterminate.cc
 
-libsupc___la_SOURCES = $(sources) $(c_sources)
-libsupc__convenience_la_SOURCES = $(sources) $(c_sources)
+libsupc___la_SOURCES = $(sources) tinfo2.cc $(c_sources)
+libsupc__convenience_la_SOURCES = $(sources) tinfo3.cc $(c_sources)
 glibcxxinstalldir = $(gxx_include_dir)
 glibcxxinstall_HEADERS = $(headers)
 
@@ -352,7 +353,8 @@ AM_CXXFLAGS = \
 	$(LIBSUPCXX_PICFLAGS) \
 	$(WARN_CXXFLAGS) \
 	$(OPTIMIZE_CXXFLAGS) \
-	$(CONFIG_CXXFLAGS)
+	$(CONFIG_CXXFLAGS) \
+	$(SYMVER_CXXFLAGS)
 
 AM_MAKEFLAGS = \
 	"gxx_include_dir=$(gxx_include_dir)"
--- libstdc++-v3/libsupc++/tinfo3.cc.jj	2006-01-27 17:02:28.000000000 +0100
+++ libstdc++-v3/libsupc++/tinfo3.cc	2006-01-27 17:06:49.000000000 +0100
@@ -0,0 +1,18 @@
+#include "../config.h"
+
+#include "tinfo2.cc"
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _CXXABI_LDBL_SYMVER(dbl, ldbl) \
+  asm (".symver " #dbl "," #ldbl "@CXXABI_1.3");	\
+  asm (".symver " #ldbl "," #ldbl "@@CXXABI_LDBL_1.3")
+_CXXABI_LDBL_SYMVER (_ZTIPKd, _ZTIPKe);
+_CXXABI_LDBL_SYMVER (_ZTIPd, _ZTIPe);
+_CXXABI_LDBL_SYMVER (_ZTId, _ZTIe);
+_CXXABI_LDBL_SYMVER (_ZTSPKd, _ZTSPKe);
+_CXXABI_LDBL_SYMVER (_ZTSPd, _ZTSPe);
+_CXXABI_LDBL_SYMVER (_ZTSd, _ZTSe);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/scripts/as_symver_filter.jj	2006-01-27 09:48:04.000000000 +0100
+++ libstdc++-v3/scripts/as_symver_filter	2006-01-27 10:42:07.000000000 +0100
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Assembly filter put in between cc1 and as that allows to pretend
+# that .symver symbol, symbol@@SYMBOLVER is supported by replacing
+# all occurences of symbol except symbol@ with a unique symbol name.
+
+# First argument is the original assembly file (*.sv).
+# Second argument is a temporary file for sed script (*.se).
+# Third argument is either a name of the output assembly file (*.s)
+# or -, in which case the output is stdout.
+LC_ALL=C
+export LC_ALL
+ # ;s~^&[^A-Za-z0-9_.@]~_U\&~;s~\([^A-Za-z0-9_.]\)&$~\1_U&~;s~\([^A-Za-z0-9_.]\)&\([^A-Za-z0-9_.@]\)~\1_U&\2~g/' \
+sed -n -e 's/^.*[^ 	]*\.symver[ 	][ 	]*\([A-Za-z0-9_.][A-Za-z0-9_.]*\)[ 	]*,[ 	]*\1@@.*$/\1/p' \
+  "$1" | \
+sed -e 's/^.*$/s~^&$~_U&~;s~^&[^A-Za-z0-9_.@]~_U\&~;s~\\([^A-Za-z0-9_.]\\)&$~\\1_U&~;s~\\([^A-Za-z0-9_.]\\)&\\([^A-Za-z0-9_.@]\\)~\\1_U&\\2~g/' \
+  > "$2"
+if [ "x$3" = "x-" ]; then
+  sed -f "$2" "$1"
+else
+  sed -f "$2" "$1" > "$3"
+fi
--- libstdc++-v3/src/complex_io.cc.jj	2006-01-07 18:34:01.000000000 +0100
+++ libstdc++-v3/src/complex_io.cc	2006-01-27 15:22:40.000000000 +0100
@@ -91,3 +91,20 @@ namespace std
                const complex<long double>&);
 #endif //_GLIBCXX_USE_WCHAR_T
 } // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_LDBL_SYMVER(dbl, ldbl) \
+  asm (".symver " #dbl "," #ldbl "@GLIBCXX_3.4");	\
+  asm (".symver " #ldbl "," #ldbl "@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_LDBL_SYMVER (_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E,
+		      _ZStlsIecSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E);
+_GLIBCXX_LDBL_SYMVER (_ZStlsIdwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E,
+		      _ZStlsIewSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E);
+_GLIBCXX_LDBL_SYMVER (_ZStrsIdcSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E,
+		      _ZStrsIecSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E);
+_GLIBCXX_LDBL_SYMVER (_ZStrsIdwSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E,
+		      _ZStrsIewSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/src/limits.cc.jj	2006-01-07 18:34:01.000000000 +0100
+++ libstdc++-v3/src/limits.cc	2006-01-27 11:36:22.000000000 +0100
@@ -1,6 +1,6 @@
 // Static data members of -*- C++ -*- numeric_limits classes
 
-// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation, Inc.
 //
 // 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
@@ -447,3 +447,36 @@ namespace std 
   const bool numeric_limits<long double>::tinyness_before;
   const float_round_style numeric_limits<long double>::round_style;
 } // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_NUM_LIM_SYMVER(member, len) \
+  asm (".symver _ZNSt14numeric_limitsIdE" #len #member "E,"             \
+       "_ZNSt14numeric_limitsIeE" #len #member "E@GLIBCXX_3.4");        \
+  asm (".symver _ZNSt14numeric_limitsIeE" #len #member "E,"        \
+       "_ZNSt14numeric_limitsIeE" #len #member "E@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_NUM_LIM_SYMVER (is_specialized, 14);
+_GLIBCXX_NUM_LIM_SYMVER (digits, 6);
+_GLIBCXX_NUM_LIM_SYMVER (digits10, 8);
+_GLIBCXX_NUM_LIM_SYMVER (is_signed, 9);
+_GLIBCXX_NUM_LIM_SYMVER (is_integer, 10);
+_GLIBCXX_NUM_LIM_SYMVER (is_exact, 8);
+_GLIBCXX_NUM_LIM_SYMVER (radix, 5);
+_GLIBCXX_NUM_LIM_SYMVER (min_exponent, 12);
+_GLIBCXX_NUM_LIM_SYMVER (min_exponent10, 14);
+_GLIBCXX_NUM_LIM_SYMVER (max_exponent, 12);
+_GLIBCXX_NUM_LIM_SYMVER (max_exponent10, 14);
+_GLIBCXX_NUM_LIM_SYMVER (has_infinity, 12);
+_GLIBCXX_NUM_LIM_SYMVER (has_quiet_NaN, 13);
+_GLIBCXX_NUM_LIM_SYMVER (has_signaling_NaN, 17);
+_GLIBCXX_NUM_LIM_SYMVER (has_denorm, 10);
+_GLIBCXX_NUM_LIM_SYMVER (has_denorm_loss, 15);
+_GLIBCXX_NUM_LIM_SYMVER (is_iec559, 9);
+_GLIBCXX_NUM_LIM_SYMVER (is_bounded, 10);
+_GLIBCXX_NUM_LIM_SYMVER (is_modulo, 9);
+_GLIBCXX_NUM_LIM_SYMVER (traps, 5);
+_GLIBCXX_NUM_LIM_SYMVER (tinyness_before, 15);
+_GLIBCXX_NUM_LIM_SYMVER (round_style, 11);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/src/Makefile.am.jj	2006-01-17 10:46:51.000000000 +0100
+++ libstdc++-v3/src/Makefile.am	2006-01-27 11:44:47.000000000 +0100
@@ -35,10 +35,15 @@ libstdc++-symbol.ver:  ${glibcxx_srcdir}
 		$(port_specific_symbol_files)
 	cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
 	if test "x$(port_specific_symbol_files)" != x; then \
-	  sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
-	  sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
-	  cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
-	  rm tmp.top tmp.bottom; \
+	  if grep '^# Appended to version file.' \
+	       $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
+	    cat $(port_specific_symbol_files) >> $@; \
+	  else \
+	    sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
+	    sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
+	    cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
+	    rm tmp.top tmp.bottom; \
+	  fi; \
 	fi
 
 if ENABLE_SYMVERS_GNU
@@ -200,7 +205,8 @@ AM_CXXFLAGS = \
 	-fno-implicit-templates \
 	$(WARN_CXXFLAGS) \
 	$(OPTIMIZE_CXXFLAGS) \
-	$(CONFIG_CXXFLAGS)
+	$(CONFIG_CXXFLAGS) \
+	$(SYMVER_CXXFLAGS)
 
 
 # libstdc++ libtool notes
--- libstdc++-v3/src/Makefile.in.jj	2006-01-17 10:46:51.000000000 +0100
+++ libstdc++-v3/src/Makefile.in	2006-01-27 17:41:51.000000000 +0100
@@ -185,6 +185,7 @@ SECTION_LDFLAGS = @SECTION_LDFLAGS@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+SYMVER_CXXFLAGS = @SYMVER_CXXFLAGS@
 SYMVER_MAP = @SYMVER_MAP@
 TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
 USE_NLS = @USE_NLS@
@@ -375,7 +376,8 @@ AM_CXXFLAGS = \
 	-fno-implicit-templates \
 	$(WARN_CXXFLAGS) \
 	$(OPTIMIZE_CXXFLAGS) \
-	$(CONFIG_CXXFLAGS)
+	$(CONFIG_CXXFLAGS) \
+	$(SYMVER_CXXFLAGS)
 
 
 # libstdc++ libtool notes
@@ -677,10 +679,15 @@ libstdc++-symbol.ver:  ${glibcxx_srcdir}
 		$(port_specific_symbol_files)
 	cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
 	if test "x$(port_specific_symbol_files)" != x; then \
-	  sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
-	  sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
-	  cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
-	  rm tmp.top tmp.bottom; \
+	  if grep '^# Appended to version file.' \
+	       $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
+	    cat $(port_specific_symbol_files) >> $@; \
+	  else \
+	    sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
+	    sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
+	    cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
+	    rm tmp.top tmp.bottom; \
+	  fi; \
 	fi
 @ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@libstdc++-symbol.explist : libstdc++-symbol.ver \
 @ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@		${glibcxx_srcdir}/scripts/make_exports.pl \
--- libstdc++-v3/src/istream-inst.cc.jj	2006-01-07 18:34:01.000000000 +0100
+++ libstdc++-v3/src/istream-inst.cc	2006-01-27 15:30:28.000000000 +0100
@@ -68,3 +68,15 @@ namespace std
   template wistream& operator>>(wistream&, _Setw);
 #endif
 } // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_LDBL_SYMVER(dbl, ldbl) \
+  asm (".symver " #dbl "," #ldbl "@GLIBCXX_3.4");	\
+  asm (".symver " #ldbl "," #ldbl "@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_LDBL_SYMVER (_ZNSirsERd, _ZNSirsERe);
+_GLIBCXX_LDBL_SYMVER (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd,
+		      _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/src/locale-inst.cc.jj	2006-01-07 18:34:01.000000000 +0100
+++ libstdc++-v3/src/locale-inst.cc	2006-01-27 16:40:01.000000000 +0100
@@ -37,6 +37,7 @@
 // Instantiation configuration.
 #ifndef C
 # define C char
+# define Cc "c"
 #endif
 
 namespace std
@@ -314,3 +315,35 @@ namespace std
 		  ios_base::fmtflags, bool);
 #endif
 } // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_LDBLS_SYMVER(dbl, ldbl) \
+  asm (".symver " dbl "," ldbl "@GLIBCXX_3.4");	\
+  asm (".symver " ldbl "," ldbl "@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt7num_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3getES3_S3_RSt8ios_baseRSt12_Ios_IostateRd",
+		       "_ZNKSt7num_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3getES3_S3_RSt8ios_baseRSt12_Ios_IostateRe");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt7num_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateRd",
+		       "_ZNKSt7num_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateRe");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt7num_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE15_M_insert_floatIdEES3_S3_RSt8ios_base"Cc"cT_",
+		       "_ZNKSt7num_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE15_M_insert_floatIeEES3_S3_RSt8ios_base"Cc"cT_");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt7num_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3putES3_RSt8ios_base"Cc"d",
+		       "_ZNKSt7num_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3putES3_RSt8ios_base"Cc"e");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt7num_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_putES3_RSt8ios_base"Cc"d",
+		       "_ZNKSt7num_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_putES3_RSt8ios_base"Cc"e");
+// FIXME: The following 4 can't be done this way, as there are no money_get/money_put members with
+// double arguments, only long double.  So we need something like a wrapper function (or method?)
+// that just calls the long double method (though through an non-exported alias) and
+// afterwards converts the long double temporary to the double reference (money_get) resp.
+// before the call converts the long double argument to double.
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt9money_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRd",
+		       "_ZNKSt9money_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRe");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt9money_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRd",
+		       "_ZNKSt9money_getI"Cc"St19istreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRe");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt9money_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3putES3_bRSt8ios_base"Cc"d",
+		       "_ZNKSt9money_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE3putES3_bRSt8ios_base"Cc"e");
+_GLIBCXX_LDBLS_SYMVER ("_ZNKSt9money_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_putES3_bRSt8ios_base"Cc"d",
+		       "_ZNKSt9money_putI"Cc"St19ostreambuf_iteratorI"Cc"St11char_traitsI"Cc"EEE6do_putES3_bRSt8ios_base"Cc"e");
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/src/ostream-inst.cc.jj	2006-01-07 18:34:01.000000000 +0100
+++ libstdc++-v3/src/ostream-inst.cc	2006-01-27 15:48:32.000000000 +0100
@@ -74,3 +74,15 @@ namespace std
   template wostream& operator<<(wostream&, _Setw);
 #endif
 } // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_LDBL_SYMVER(dbl, ldbl) \
+  asm (".symver " #dbl "," #ldbl "@GLIBCXX_3.4");	\
+  asm (".symver " #ldbl "," #ldbl "@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_LDBL_SYMVER (_ZNSolsEd, _ZNSolsEe);
+_GLIBCXX_LDBL_SYMVER (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd,
+		      _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/src/wlocale-inst.cc.jj	2005-11-12 18:07:30.000000000 +0100
+++ libstdc++-v3/src/wlocale-inst.cc	2006-01-27 15:57:05.000000000 +0100
@@ -35,5 +35,6 @@
 
 #ifdef _GLIBCXX_USE_WCHAR_T
 #define C wchar_t
+#define Cc "w"
 #include "locale-inst.cc"
 #endif
--- libstdc++-v3/config/locale/gnu/c_locale.cc.jj	2006-01-07 18:34:02.000000000 +0100
+++ libstdc++-v3/config/locale/gnu/c_locale.cc	2006-01-27 14:41:27.000000000 +0100
@@ -132,3 +132,14 @@ namespace std
 {
   const char* const* const locale::_S_categories = __gnu_cxx::category_names;
 }  // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_LDBL_SYMVER(dbl, ldbl) \
+  asm (".symver " #dbl "," #ldbl "@GLIBCXX_3.4");	\
+  asm (".symver " #ldbl "," #ldbl "@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_LDBL_SYMVER (_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct,
+		      _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/config/locale/generic/c_locale.cc.jj	2006-01-07 18:34:02.000000000 +0100
+++ libstdc++-v3/config/locale/generic/c_locale.cc	2006-01-27 14:42:20.000000000 +0100
@@ -168,3 +168,14 @@ namespace std
 {
   const char* const* const locale::_S_categories = __gnu_cxx::category_names;
 }  // namespace std
+
+#if defined(_GLIBCXX_SYMVER) && defined(PIC) \
+    && defined(_GLIBCXX_LONG_DOUBLE_COMPAT)
+
+#define _GLIBCXX_LDBL_SYMVER(dbl, ldbl) \
+  asm (".symver " #dbl "," #ldbl "@GLIBCXX_3.4");	\
+  asm (".symver " #ldbl "," #ldbl "@@GLIBCXX_LDBL_3.4")
+_GLIBCXX_LDBL_SYMVER (_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct,
+		      _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct);
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver.jj	2006-01-25 16:44:40.000000000 +0100
+++ libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver	2006-01-25 17:23:41.000000000 +0100
@@ -0,0 +1,27 @@
+# Appended to version file.
+
+GLIBCXX_LDBL_3.4 {
+  _ZNSt14numeric_limitsIe*;
+  _ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE3getES3_S3_RSt8ios_baseRSt12_Ios_IostateRe;
+  _ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateRe;
+  _ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE15_M_insert_floatIeEES3_S3_RSt8ios_base[cw]cT_;
+  _ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE3putES3_RSt8ios_base[cw]e;
+  _ZNKSt7num_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE6do_putES3_RSt8ios_base[cw]e;
+  _ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE3getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRe;
+  _ZNKSt9money_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE6do_getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRe;
+  _ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE3putES3_bRSt8ios_base[cw]e;
+  _ZNKSt9money_putI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEE6do_putES3_bRSt8ios_base[cw]e;
+  _ZNSirsERe;
+  _ZNSolsEe;
+  _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe;
+  _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe;
+  _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct;
+  _ZStlsIe[cw]St11char_traitsI[cw]EERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E;
+  _ZStrsIe[cw]St11char_traitsI[cw]EERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E;
+};
+
+CXXABI_LDBL_1.3 {
+  _ZT[IS]e;
+  _ZT[IS]Pe;
+  _ZT[IS]PKe;
+};
--- libstdc++-v3/configure.jj	2006-01-23 22:45:41.000000000 +0100
+++ libstdc++-v3/configure	2006-01-27 11:30:03.000000000 +0100
@@ -309,7 +309,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV SYMVER_MAP port_specific_symbol_files ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_DARWIN_EXPORT_TRUE ENABLE_SYMVERS_DARWIN_EXPORT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV SYMVER_MAP port_specific_symbol_files ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_DARWIN_EXPORT_TRUE ENABLE_SYMVERS_DARWIN_EXPORT_FALSE baseline_dir SYMVER_CXXFLAGS ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -88626,6 +88626,77 @@ done
 
 
 
+SYMVER_CXXFLAGS=
+case "$target" in
+  powerpc*-*-*gnu* | \
+  sparc*-*-linux* | \
+  s390*-*-linux* | \
+  alpha*-*-linux*)
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+#if !defined __LONG_DOUBLE_128__ || (defined (__sparc__) && defined (__arch64__))
+#error no need for long double compatibility
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_ldbl_compat=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_ldbl_compat=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  if test "$ac_ldbl_compat" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_LONG_DOUBLE_COMPAT 1
+_ACEOF
+
+    port_specific_symbol_files="\$(top_srcdir)/config/os/gnu-linux/ldbl-extra.ver"
+    $CC $CFLAGS -dumpspecs \
+      | sed '/^\*invoke_as:/{N;s/%{!S:-o %|.s |/%{!S:-o %{DPIC:%g.sv |/;a\
+  as_symver_filter %g.sv %g.se %|.s ;:%|.s } |
+;}' > as_symver_specs
+    SYMVER_CXXFLAGS="-specs=\$(top_builddir)/as_symver_specs -B\$(top_srcdir)/scripts/"
+  fi
+esac
+
+
 # Propagate the target-specific source directories through the build chain.
 ATOMICITY_SRCDIR=config/${atomicity_dir}
 ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
@@ -89759,6 +89830,7 @@ s,@ENABLE_SYMVERS_GNU_FALSE@,$ENABLE_SYM
 s,@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@,$ENABLE_SYMVERS_DARWIN_EXPORT_TRUE,;t t
 s,@ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@,$ENABLE_SYMVERS_DARWIN_EXPORT_FALSE,;t t
 s,@baseline_dir@,$baseline_dir,;t t
+s,@SYMVER_CXXFLAGS@,$SYMVER_CXXFLAGS,;t t
 s,@ATOMICITY_SRCDIR@,$ATOMICITY_SRCDIR,;t t
 s,@ATOMIC_WORD_SRCDIR@,$ATOMIC_WORD_SRCDIR,;t t
 s,@CPU_DEFINES_SRCDIR@,$CPU_DEFINES_SRCDIR,;t t
--- libstdc++-v3/configure.ac.jj	2006-01-17 10:46:56.000000000 +0100
+++ libstdc++-v3/configure.ac	2006-01-27 11:29:44.000000000 +0100
@@ -284,6 +284,30 @@ GLIBCXX_ENABLE_SYMVERS([yes])
 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
 GLIBCXX_CONFIGURE_TESTSUITE
 
+SYMVER_CXXFLAGS=
+case "$target" in
+  powerpc*-*-*gnu* | \
+  sparc*-*-linux* | \
+  s390*-*-linux* | \
+  alpha*-*-linux*)
+  AC_TRY_COMPILE(, [
+#if !defined __LONG_DOUBLE_128__ || (defined (__sparc__) && defined (__arch64__))
+#error no need for long double compatibility
+#endif
+  ], [ac_ldbl_compat=yes], [ac_ldbl_compat=no])
+  if test "$ac_ldbl_compat" = yes; then
+    AC_DEFINE([_GLIBCXX_LONG_DOUBLE_COMPAT],1,
+	      [Define if compatibility should be provided for -mlong-double-64.])
+    port_specific_symbol_files="\$(top_srcdir)/config/os/gnu-linux/ldbl-extra.ver"
+    $CC $CFLAGS -dumpspecs \
+      | sed '/^\*invoke_as:/{N;s/%{!S:-o %|.s |/%{!S:-o %{DPIC:%g.sv |/;a\
+  as_symver_filter %g.sv %g.se %|.s ;:%|.s } |
+;}' > as_symver_specs
+    SYMVER_CXXFLAGS="-specs=\$(top_builddir)/as_symver_specs -B\$(top_srcdir)/scripts/"
+  fi
+esac
+AC_SUBST(SYMVER_CXXFLAGS)
+
 # Propagate the target-specific source directories through the build chain.
 ATOMICITY_SRCDIR=config/${atomicity_dir}
 ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
--- libstdc++-v3/config.h.in.jj	2006-01-17 10:46:56.000000000 +0100
+++ libstdc++-v3/config.h.in	2006-01-25 16:27:58.000000000 +0100
@@ -658,6 +658,9 @@
 /* Define to 1 if a full hosted library is built, or 0 if freestanding. */
 #undef _GLIBCXX_HOSTED
 
+/* Define if compatibility should be provided for -mlong-double-64. */
+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
+
 /* Define if ptrdiff_t is int. */
 #undef _GLIBCXX_PTRDIFF_T_IS_INT
 
--- libstdc++-v3/Makefile.in.jj	2006-01-17 10:46:56.000000000 +0100
+++ libstdc++-v3/Makefile.in	2006-01-27 17:41:52.000000000 +0100
@@ -183,6 +183,7 @@ SECTION_LDFLAGS = @SECTION_LDFLAGS@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+SYMVER_CXXFLAGS = @SYMVER_CXXFLAGS@
 SYMVER_MAP = @SYMVER_MAP@
 TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
 USE_NLS = @USE_NLS@

	Jakub



More information about the Gcc-patches mailing list