a32d62a
2007-04-20  Luis Machado  <luisgpm@br.ibm.com>
a32d62a
a32d62a
	* rs6000-tdep.c (rs6000_gdbarch_init): Set the long double format for
a32d62a
	powerpc64.
a32d62a
	* configure.host : Set the host long double format for powerpc64 to be
a32d62a
	a 128-bit type defined in libiberty/floatformat.c.
a32d62a
	* ppc-linux-tdep.c (ppc_linux_init_abi): Remove code that sets long double 
a32d62a
	size to 8 bytes. This breaks expression evaluation by overriding the 
a32d62a
	default.
a32d62a
	* floatformat.c : Introduce default floatformat structs to describe the
a32d62a
	128-bit long double found on the powerpc64. Description does not fully
a32d62a
	describe this format which is actually a pair of 64-bit doubles. However
a32d62a
	we are relying on floatformat_to_doublest() recognizing that this is
a32d62a
	also the default host floatformat.
a32d62a
	* floatformat.h : Default floatformat structs for powerpc64 128-bit
a32d62a
	long doubles.
a32d62a
a32d62a
Index: ./gdb/configure.host
a32d62a
===================================================================
a32d62a
--- ./gdb/configure.host.orig	2007-04-21 23:51:06.000000000 -0300
a32d62a
+++ ./gdb/configure.host	2007-04-21 23:51:09.000000000 -0300
a32d62a
@@ -179,6 +179,11 @@
a32d62a
 	gdb_host_double_format="&floatformat_ieee_double_big"
a32d62a
 	gdb_host_long_double_format="&floatformat_m68881_ext"
a32d62a
 	;;
a32d62a
+powerpc64-*-*)
a32d62a
+	gdb_host_float_format=0
a32d62a
+	gdb_host_double_format=0
a32d62a
+	gdb_host_long_double_format="&floatformat_ppc64_long_double_big"
a32d62a
+	;;
a32d62a
 *)
a32d62a
 	gdb_host_float_format=0
a32d62a
 	gdb_host_double_format=0
a32d62a
Index: ./gdb/rs6000-tdep.c
a32d62a
===================================================================
a32d62a
--- ./gdb/rs6000-tdep.c.orig	2007-04-21 23:51:06.000000000 -0300
a32d62a
+++ ./gdb/rs6000-tdep.c	2007-04-21 23:51:09.000000000 -0300
a32d62a
@@ -3442,7 +3442,19 @@
a32d62a
   set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
a32d62a
   set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
a32d62a
   if (sysv_abi)
a32d62a
-    set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
a32d62a
+    {
a32d62a
+      int byte_order = gdbarch_byte_order (gdbarch);
a32d62a
+
a32d62a
+      if (byte_order == BFD_ENDIAN_BIG)
a32d62a
+        set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big);
a32d62a
+      else if (byte_order == BFD_ENDIAN_LITTLE) 
a32d62a
+        set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little);
a32d62a
+      else
a32d62a
+        internal_error (__FILE__, __LINE__,
a32d62a
+                      _("rs6000_gdbarch_init: "
a32d62a
+                        "bad byte order"));
a32d62a
+      set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
a32d62a
+    }
a32d62a
   else
a32d62a
     set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
a32d62a
   set_gdbarch_char_signed (gdbarch, 0);
a32d62a
Index: ./include/floatformat.h
a32d62a
===================================================================
a32d62a
--- ./include/floatformat.h.orig	2007-04-21 23:51:06.000000000 -0300
a32d62a
+++ ./include/floatformat.h	2007-04-21 23:51:09.000000000 -0300
a32d62a
@@ -118,6 +118,9 @@
a32d62a
 extern const struct floatformat floatformat_ia64_spill_little;
a32d62a
 extern const struct floatformat floatformat_ia64_quad_big;
a32d62a
 extern const struct floatformat floatformat_ia64_quad_little;
a32d62a
+/* ppc64 long double implemented as 2 doubles */
a32d62a
+extern const struct floatformat floatformat_ppc64_long_double_big;
a32d62a
+extern const struct floatformat floatformat_ppc64_long_double_little;
a32d62a
 
a32d62a
 /* Convert from FMT to a double.
a32d62a
    FROM is the address of the extended float.
a32d62a
Index: ./libiberty/floatformat.c
a32d62a
===================================================================
a32d62a
--- ./libiberty/floatformat.c.orig	2007-04-21 23:51:06.000000000 -0300
a32d62a
+++ ./libiberty/floatformat.c	2007-04-21 23:51:09.000000000 -0300
a32d62a
@@ -106,6 +106,25 @@
a32d62a
   floatformat_always_valid
a32d62a
 };
a32d62a
 
a32d62a
+/* floatformats for ppc64 long double, big and little endian.           */
a32d62a
+/* The layout is a pair of doubles. Don't use this description to pass  */
a32d62a
+/* information to get_field(). The bit size is the important thing.     */
a32d62a
+const struct floatformat floatformat_ppc64_long_double_big =
a32d62a
+{
a32d62a
+  floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52, 
a32d62a
+  floatformat_intbit_no,
a32d62a
+  "floatformat_ppc64_long_double_big",
a32d62a
+  floatformat_always_valid
a32d62a
+};
a32d62a
+
a32d62a
+const struct floatformat floatformat_ppc64_long_double_little =
a32d62a
+{
a32d62a
+  floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52, 
a32d62a
+  floatformat_intbit_no,
a32d62a
+  "floatformat_ppc64_long_double_little",
a32d62a
+  floatformat_always_valid
a32d62a
+};
a32d62a
+
a32d62a
 /* floatformat for IEEE double, little endian byte order, with big endian word
a32d62a
    ordering, as on the ARM.  */
a32d62a
 
a32d62a
Index: ./gdb/ppc-linux-tdep.c
a32d62a
===================================================================
a32d62a
--- ./gdb/ppc-linux-tdep.c.orig	2007-04-21 19:48:50.000000000 -0300
a32d62a
+++ ./gdb/ppc-linux-tdep.c	2007-04-22 00:29:50.000000000 -0300
a32d62a
@@ -1059,7 +1059,8 @@
a32d62a
 {
a32d62a
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
a32d62a
 
a32d62a
-  /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
a32d62a
+#if 0
a32d62a
+	/* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
a32d62a
      Supplement says that long doubles are sixteen bytes long.
a32d62a
      However, as one of the known warts of its ABI, PPC GNU/Linux uses
a32d62a
      eight-byte long doubles.  GCC only recently got 128-bit long
a32d62a
@@ -1068,6 +1069,7 @@
a32d62a
      double' on PPC GNU/Linux are non-conformant.  */
a32d62a
   /* NOTE: cagney/2005-01-25: True for both 32- and 64-bit.  */
a32d62a
   set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
a32d62a
+#endif
a32d62a
 
a32d62a
   if (tdep->wordsize == 4)
a32d62a
     {
eb9d945
eb9d945
eb9d945
eb9d945
2007-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
eb9d945
eb9d945
	Port to GDB-6.7.
eb9d945
eb9d945
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-patched/gdb/gdbtypes.c gdb-6.7/gdb/gdbtypes.c
eb9d945
--- gdb-6.7-patched/gdb/gdbtypes.c	2007-09-05 02:51:48.000000000 +0200
eb9d945
+++ gdb-6.7/gdb/gdbtypes.c	2007-10-17 12:09:00.000000000 +0200
eb9d945
@@ -95,6 +95,10 @@ const struct floatformat *floatformats_v
eb9d945
   &floatformat_vax_d,
eb9d945
   &floatformat_vax_d
eb9d945
 };
eb9d945
+const struct floatformat *floatformat_ppc64_long_double[BFD_ENDIAN_UNKNOWN] = {
eb9d945
+  &floatformat_ppc64_long_double_big,
eb9d945
+  &floatformat_ppc64_long_double_little
eb9d945
+};
eb9d945
 
eb9d945
 struct type *builtin_type_ieee_single;
eb9d945
 struct type *builtin_type_ieee_double;
eb9d945
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-patched/gdb/gdbtypes.h gdb-6.7/gdb/gdbtypes.h
eb9d945
--- gdb-6.7-patched/gdb/gdbtypes.h	2007-09-05 02:51:48.000000000 +0200
eb9d945
+++ gdb-6.7/gdb/gdbtypes.h	2007-10-17 12:08:30.000000000 +0200
eb9d945
@@ -1121,6 +1121,7 @@ extern const struct floatformat *floatfo
eb9d945
 extern const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN];
eb9d945
 extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
eb9d945
 extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
eb9d945
+extern const struct floatformat *floatformat_ppc64_long_double[BFD_ENDIAN_UNKNOWN];
eb9d945
 
eb9d945
 extern struct type *builtin_type_ieee_single;
eb9d945
 extern struct type *builtin_type_ieee_double;
eb9d945
diff -u -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-patched/gdb/rs6000-tdep.c gdb-6.7/gdb/rs6000-tdep.c
eb9d945
--- gdb-6.7-patched/gdb/rs6000-tdep.c	2007-10-16 20:52:45.000000000 +0200
eb9d945
+++ gdb-6.7/gdb/rs6000-tdep.c	2007-10-17 12:07:54.000000000 +0200
eb9d945
@@ -3755,16 +3755,7 @@ rs6000_gdbarch_init (struct gdbarch_info
eb9d945
   set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
eb9d945
   if (sysv_abi)
eb9d945
     {
eb9d945
-      int byte_order = gdbarch_byte_order (gdbarch);
eb9d945
-
eb9d945
-      if (byte_order == BFD_ENDIAN_BIG)
eb9d945
-        set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big);
eb9d945
-      else if (byte_order == BFD_ENDIAN_LITTLE) 
eb9d945
-        set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little);
eb9d945
-      else
eb9d945
-        internal_error (__FILE__, __LINE__,
eb9d945
-                      _("rs6000_gdbarch_init: "
eb9d945
-                        "bad byte order"));
eb9d945
+      set_gdbarch_long_double_format (gdbarch, floatformat_ppc64_long_double);
eb9d945
       set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
eb9d945
     }
eb9d945
   else