File gcc41-ldbl-default.patch of Package gcc41

2006-02-05  Jakub Jelinek  <jakub@redhat.com>

	* config.gcc (s390-*-linux*): Add s390/t-linux to tmake_file.
	(s390x-*-linux*): Likewise.
	* config/s390/t-linux64 (SHLIB_MAPFILES): Removed.
	* config/s390/t-linux: New file.

	* config.gcc (sparc-*-linux*): Add sparc/t-linux to tmake_file.
	(sparc64-*-linux*): Likewise.
	* config/sparc/t-linux64 (SHLIB_MAPFILES): Removed.
	* config/sparc/t-linux: New file.
	* config/sparc/libgcc-sparc-glibc.ver (__fixtfdi, __fixunstfdi,
	__floatditf): Export at GCC_LDBL_3.0 if -m32 -mlong-double-128.
	(__divtc3, __multc3, __powitf2): Export at GCC_LDBL_4.0.0 if
	-m32 -mlong-double-128.

	* config.gcc (alpha*-*-linux*): Add alpha/t-linux to tmake_file.
	* config/alpha/t-linux: New file.
	* config/alpha/libgcc-alpha-ldbl.ver: New file.

2006-02-04  Jakub Jelinek  <jakub@redhat.com>

	* config/sparc/linux.h (TARGET_OS_CPP_BUILTINS): Define
	__LONG_DOUBLE_128__ if TARGET_LONG_DOUBLE_128.
	(CPP_SUBTARGET_SPEC): Don't add -D__LONG_DOUBLE_128__ here.
	* config/sparc/linux64.h (TARGET_OS_CPP_BUILTINS): Define
	__LONG_DOUBLE_128__ if TARGET_LONG_DOUBLE_128 and TARGET_ARCH32.
	(CPP_ARCH32_SPEC): Remove.

2006-02-03  Aldy Hernandez  <aldyh@redhat.com>

	* config/s390/s390.c (override_options): Handle
	TARGET_DEFAULT_LONG_DOUBLE_128.

	* config/alpha/alpha.c (override_options): Handle
	TARGET_DEFAULT_LONG_DOUBLE_128.

	* config/sparc/sparc.c (sparc_override_options): Handle
	TARGET_DEFAULT_LONG_DOUBLE_128.

2006-02-04  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.

Index: gcc/config/rs6000/linux.h
===================================================================
--- gcc/config/rs6000/linux.h.orig	2006-02-11 19:40:32.000000000 +0100
+++ gcc/config/rs6000/linux.h	2009-11-20 13:42:00.000000000 +0100
@@ -120,3 +120,8 @@
 #endif
 
 #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
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h.orig	2006-02-11 19:40:32.000000000 +0100
+++ gcc/config/rs6000/linux64.h	2009-11-20 13:42:00.000000000 +0100
@@ -570,3 +570,8 @@ while (0)
 #endif
 
 #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
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac.orig	2009-11-20 13:40:48.000000000 +0100
+++ gcc/configure.ac	2009-11-20 13:42:00.000000000 +0100
@@ -3128,6 +3128,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
Index: gcc/configure
===================================================================
--- gcc/configure.orig	2009-11-20 13:40:48.000000000 +0100
+++ gcc/configure	2009-11-20 13:42:00.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]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*)
@@ -16210,6 +16211,46 @@ cat >>confdefs.h <<\_ACEOF
 _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.
 
Index: gcc/config.in
===================================================================
--- gcc/config.in.orig	2006-11-14 10:28:54.000000000 +0100
+++ gcc/config.in	2009-11-20 13:42: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
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c.orig	2006-03-30 17:18:46.000000000 +0200
+++ gcc/config/alpha/alpha.c	2009-11-20 13:42:00.000000000 +0100
@@ -516,6 +516,11 @@ override_options (void)
       REAL_MODE_FORMAT (DFmode) = &vax_g_format;
       REAL_MODE_FORMAT (TFmode) = NULL;
     }
+
+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
+  if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
+    target_flags |= MASK_LONG_DOUBLE_128;
+#endif
 }
 
 /* Returns 1 if VALUE is a mask that contains full bytes of zero or ones.  */
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c.orig	2006-11-29 10:58:42.000000000 +0100
+++ gcc/config/s390/s390.c	2009-11-20 13:42:00.000000000 +0100
@@ -1433,6 +1433,11 @@ override_options (void)
     }
   else if (s390_stack_guard)
     error ("-mstack-guard implies use of -mstack-size"); 
+
+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
+  if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
+    target_flags |= MASK_LONG_DOUBLE_128;
+#endif
 }
 
 /* Map for smallest class containing reg regno.  */
Index: gcc/config/sparc/linux.h
===================================================================
--- gcc/config/sparc/linux.h.orig	2006-02-11 19:40:32.000000000 +0100
+++ gcc/config/sparc/linux.h	2009-11-20 13:42:00.000000000 +0100
@@ -23,17 +23,19 @@ Boston, MA 02110-1301, USA.  */
 #define TARGET_OS_CPP_BUILTINS()		\
   do						\
     {						\
-	builtin_define_std ("unix");		\
-	builtin_define_std ("linux");		\
-	builtin_define ("__gnu_linux__");	\
-	builtin_assert ("system=linux");	\
-	builtin_assert ("system=unix");		\
-	builtin_assert ("system=posix");	\
-	if (flag_pic)				\
-	  {					\
-		builtin_define ("__PIC__");	\
-		builtin_define ("__pic__");	\
-	  }					\
+      builtin_define_std ("unix");		\
+      builtin_define_std ("linux");		\
+      builtin_define ("__gnu_linux__");		\
+      builtin_assert ("system=linux");		\
+      builtin_assert ("system=unix");		\
+      builtin_assert ("system=posix");		\
+      if (flag_pic)				\
+	{					\
+	  builtin_define ("__PIC__");		\
+	  builtin_define ("__pic__");		\
+	}					\
+      if (TARGET_LONG_DOUBLE_128)		\
+	builtin_define ("__LONG_DOUBLE_128__");	\
     }						\
   while (0)
 
@@ -100,8 +102,7 @@ Boston, MA 02110-1301, USA.  */
 
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC \
-"%{posix:-D_POSIX_SOURCE} \
-%{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}"
+"%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
 
 #undef LIB_SPEC
 #define LIB_SPEC \
Index: gcc/config/sparc/sparc.c
===================================================================
--- gcc/config/sparc/sparc.c.orig	2006-04-17 11:29:54.000000000 +0200
+++ gcc/config/sparc/sparc.c	2009-11-20 13:42:00.000000000 +0100
@@ -790,6 +790,11 @@ sparc_override_options (void)
       sparc_costs = &ultrasparc3_costs;
       break;
     };
+
+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
+  if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
+    target_flags |= MASK_LONG_DOUBLE_128;
+#endif
 }
 
 #ifdef SUBTARGET_ATTRIBUTE_TABLE
Index: gcc/config/sparc/linux64.h
===================================================================
--- gcc/config/sparc/linux64.h.orig	2006-02-11 19:40:32.000000000 +0100
+++ gcc/config/sparc/linux64.h	2009-11-20 13:42:00.000000000 +0100
@@ -20,22 +20,24 @@ along with GCC; see the file COPYING.  I
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-	builtin_define_std ("unix");		\
-	builtin_define_std ("linux");		\
-	builtin_define ("_LONGLONG");		\
-	builtin_define ("__gnu_linux__");	\
-	builtin_assert ("system=linux");	\
-	builtin_assert ("system=unix");		\
-	builtin_assert ("system=posix");	\
-	if (flag_pic)				\
-	  {					\
-		builtin_define ("__PIC__");	\
-		builtin_define ("__pic__");	\
-	  }					\
-    }						\
+#define TARGET_OS_CPP_BUILTINS()			\
+  do							\
+    {							\
+      builtin_define_std ("unix");			\
+      builtin_define_std ("linux");			\
+      builtin_define ("_LONGLONG");			\
+      builtin_define ("__gnu_linux__");			\
+      builtin_assert ("system=linux");			\
+      builtin_assert ("system=unix");			\
+      builtin_assert ("system=posix");			\
+      if (flag_pic)					\
+	{						\
+	  builtin_define ("__PIC__");			\
+	  builtin_define ("__pic__");			\
+	}						\
+      if (TARGET_ARCH32 && TARGET_LONG_DOUBLE_128)	\
+	builtin_define ("__LONG_DOUBLE_128__");		\
+    }							\
   while (0)
 
 /* Don't assume anything about the header files.  */
@@ -59,13 +61,6 @@ Boston, MA 02110-1301, USA.  */
 #undef ASM_CPU_DEFAULT_SPEC
 #define ASM_CPU_DEFAULT_SPEC "-Av9a"
 
-#ifdef SPARC_BI_ARCH
-
-#undef CPP_ARCH32_SPEC
-#define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__}"
-
-#endif
-
 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
    provides part of the support for getting C++ file-scope static
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc.orig	2009-11-20 13:41:10.000000000 +0100
+++ gcc/config.gcc	2009-11-20 13:42:00.000000000 +0100
@@ -568,7 +568,7 @@ alpha*-*-unicosmk*)
 alpha*-*-linux*)
 	tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
 	target_cpu_default="MASK_GAS"
-	tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee"
+	tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee alpha/t-linux"
 	;;
 alpha*-*-gnu*)
 	target_cpu_default="MASK_GAS"
@@ -2056,7 +2056,7 @@ sparc-*-elf*)
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
-	tmake_file="${tmake_file} sparc/t-crtfm"
+	tmake_file="${tmake_file} sparc/t-linux sparc/t-crtfm"
 	;;
 sparc-*-rtems*)
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h"
@@ -2175,7 +2175,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
 	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux64.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
-	tmake_file="${tmake_file} sparc/t-linux64 sparc/t-crtfm"
+	tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64 sparc/t-crtfm"
 	;;
 sparc64-*-netbsd*)
 	tm_file="sparc/biarch64.h ${tm_file}"
Index: gcc/config/alpha/libgcc-alpha-ldbl.ver
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/alpha/libgcc-alpha-ldbl.ver	2009-11-20 13:42:00.000000000 +0100
@@ -0,0 +1,32 @@
+%ifdef __LONG_DOUBLE_128__
+
+# long double 128 bit support in libgcc_s.so.1 is only available
+# when configured with --with-long-double-128.  Make sure all the
+# symbols are available at @@GCC_LDBL_* versions to make it clear
+# there is a configurable symbol set.
+
+%exclude {
+  __fixtfdi
+  __fixunstfdi
+  __floatditf
+
+  __divtc3
+  __multc3
+  __powitf2
+}
+
+%inherit GCC_LDBL_3.0 GCC_3.0
+GCC_LDBL_3.0 {
+  __fixtfdi
+  __fixunstfdi
+  __floatditf
+}
+
+%inherit GCC_LDBL_4.0.0 GCC_4.0.0
+GCC_LDBL_4.0.0 {
+  __divtc3
+  __multc3
+  __powitf2
+}
+
+%endif
Index: gcc/config/alpha/t-linux
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/alpha/t-linux	2009-11-20 13:42:00.000000000 +0100
@@ -0,0 +1 @@
+SHLIB_MAPFILES += $(srcdir)/config/alpha/libgcc-alpha-ldbl.ver
Index: gcc/config/sparc/t-linux64
===================================================================
--- gcc/config/sparc/t-linux64.orig	2006-02-07 17:44:30.000000000 +0100
+++ gcc/config/sparc/t-linux64	2009-11-20 13:42:00.000000000 +0100
@@ -8,12 +8,6 @@ INSTALL_LIBGCC = install-multilib
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \
 	crtfastmath.o
 
-# Override t-slibgcc-elf-ver to export some libgcc symbols with
-# the symbol versions that glibc used.
-# Avoid the t-linux version file.
-SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
-		 $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
-
 CRTSTUFF_T_CFLAGS = `if test x$$($(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) \
 				 -print-multi-os-directory) \
 			= x../lib64; then echo -mcmodel=medany; fi`
Index: gcc/config/sparc/libgcc-sparc-glibc.ver
===================================================================
--- gcc/config/sparc/libgcc-sparc-glibc.ver.orig	2006-02-07 17:44:30.000000000 +0100
+++ gcc/config/sparc/libgcc-sparc-glibc.ver	2009-11-20 13:42:00.000000000 +0100
@@ -26,3 +26,36 @@ GLIBC_VER {
   __frame_state_for
   __register_frame_info_table
 }
+
+%if !defined (__arch64__) && defined (__LONG_DOUBLE_128__)
+
+# long double 128 bit support from 32-bit libgcc_s.so.1 is only available
+# when configured with --with-long-double-128.  Make sure all the
+# symbols are available at @@GCC_LDBL_* versions to make it clear
+# there is a configurable symbol set.
+
+%exclude {
+  __fixtfdi
+  __fixunstfdi
+  __floatditf
+
+  __divtc3
+  __multc3
+  __powitf2
+}
+
+%inherit GCC_LDBL_3.0 GCC_3.0
+GCC_LDBL_3.0 {
+  __fixtfdi
+  __fixunstfdi
+  __floatditf
+}
+
+%inherit GCC_LDBL_4.0.0 GCC_4.0.0
+GCC_LDBL_4.0.0 {
+  __divtc3
+  __multc3
+  __powitf2
+}
+
+%endif
Index: gcc/config/sparc/t-linux
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gcc/config/sparc/t-linux	2009-11-20 13:42:00.000000000 +0100
@@ -0,0 +1,5 @@
+# Override t-slibgcc-elf-ver to export some libgcc symbols with
+# the symbol versions that glibc used.
+# Avoid the t-linux version file.
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
+		 $(srcdir)/config/sparc/libgcc-sparc-glibc.ver
Index: gcc/config/s390/t-linux
===================================================================
--- gcc/config/s390/t-linux.orig	2006-02-07 17:44:30.000000000 +0100
+++ gcc/config/s390/t-linux	2009-11-20 13:42:00.000000000 +0100
@@ -1,3 +1,6 @@
 # Override t-slibgcc-elf-ver to export some libgcc symbols with
 # the symbol versions that glibc used.
 SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/s390/libgcc-glibc.ver
+# Override t-slibgcc-elf-ver to export some libgcc symbols with
+# the symbol versions that glibc used.
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/s390/libgcc-glibc.ver
openSUSE Build Service is sponsored by