]> git.pld-linux.org Git - packages/gdb.git/commitdiff
- teach gdb about little-endian IBM long double (required for binutils 2.24.51.0.1) auto/th/gdb-7.6.1-2
authorJan Rękorajski <baggins@pld-linux.org>
Tue, 3 Dec 2013 19:56:56 +0000 (20:56 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Tue, 3 Dec 2013 19:56:56 +0000 (20:56 +0100)
- rel 2

floatformat_ibm_long_double.patch [new file with mode: 0644]
gdb.spec

diff --git a/floatformat_ibm_long_double.patch b/floatformat_ibm_long_double.patch
new file mode 100644 (file)
index 0000000..e803e30
--- /dev/null
@@ -0,0 +1,152 @@
+https://sourceware.org/ml/gdb-patches/2013-08/msg00483.html
+
+diff --git a/include/floatformat.h b/include/floatformat.h
+index b595164..04db61a 100644
+--- a/include/floatformat.h
++++ b/include/floatformat.h
+@@ -128,7 +128,8 @@ extern const struct floatformat floatformat_ia64_spill_little;
+ extern const struct floatformat floatformat_ia64_quad_big;
+ extern const struct floatformat floatformat_ia64_quad_little;
+ /* IBM long double (double+double).  */
+-extern const struct floatformat floatformat_ibm_long_double;
++extern const struct floatformat floatformat_ibm_long_double_big;
++extern const struct floatformat floatformat_ibm_long_double_little;
+ /* Convert from FMT to a double.
+    FROM is the address of the extended float.
+diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c
+index c58ab01..789fa05 100644
+--- a/libiberty/floatformat.c
++++ b/libiberty/floatformat.c
+@@ -371,14 +371,23 @@ floatformat_ibm_long_double_is_valid (const struct floatformat *fmt,
+     }
+ }
+-const struct floatformat floatformat_ibm_long_double =
++const struct floatformat floatformat_ibm_long_double_big =
+ {
+   floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
+   floatformat_intbit_no,
+-  "floatformat_ibm_long_double",
++  "floatformat_ibm_long_double_big",
+   floatformat_ibm_long_double_is_valid,
+   &floatformat_ieee_double_big
+ };
++
++const struct floatformat floatformat_ibm_long_double_little =
++{
++  floatformat_little, 128, 0, 1, 11, 1023, 2047, 12, 52,
++  floatformat_intbit_no,
++  "floatformat_ibm_long_double_little",
++  floatformat_ibm_long_double_is_valid,
++  &floatformat_ieee_double_little
++};
\f
+ #ifndef min
+-- 
+1.7.1
+
+diff --git a/gdb/doublest.c b/gdb/doublest.c
+index 2e4c87e..85890b1 100644
+--- a/gdb/doublest.c
++++ b/gdb/doublest.c
+@@ -190,7 +190,8 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
+     {
+       double dto;
+-      floatformat_to_double (fmt, from, &dto);
++      floatformat_to_double (fmt->split_half ? fmt->split_half : fmt,
++                           from, &dto);
+       *to = (DOUBLEST) dto;
+       return;
+     }
+@@ -514,6 +515,11 @@ floatformat_is_negative (const struct floatformat *fmt,
+   gdb_assert (fmt->totalsize
+             <= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
++  /* An IBM long double (a two element array of double) always takes the
++     sign of the first double.  */
++  if (fmt->split_half)
++    fmt = fmt->split_half;
++
+   order = floatformat_normalize_byteorder (fmt, uval, newfrom);
+   if (order != fmt->byteorder)
+@@ -540,6 +546,13 @@ floatformat_classify (const struct floatformat *fmt,
+   gdb_assert (fmt->totalsize
+             <= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
++  /* An IBM long double (a two element array of double) can be classified
++     by looking at the first double.  inf and nan are specified as
++     ignoring the second double.  zero and subnormal will always have
++     the second double 0.0 if the long double is correctly rounded.  */
++  if (fmt->split_half)
++    fmt = fmt->split_half;
++
+   order = floatformat_normalize_byteorder (fmt, uval, newfrom);
+   if (order != fmt->byteorder)
+@@ -622,6 +635,16 @@ floatformat_mantissa (const struct floatformat *fmt,
+   gdb_assert (fmt->totalsize
+             <= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
++  /* For IBM long double (a two element array of double), return the
++     mantissa of the first double.  The problem with returning the
++     actual mantissa from both doubles is that there can be an
++     arbitrary number of implied 0's or 1's between the mantissas
++     of the first and second double.  In any case, this function
++     is only used for dumping out nans, and a nan is specified to
++     ignore the value in the second double.  */
++  if (fmt->split_half)
++    fmt = fmt->split_half;
++
+   order = floatformat_normalize_byteorder (fmt, uval, newfrom);
+   if (order != fmt->byteorder)
+@@ -879,27 +902,3 @@ convert_typed_floating (const void *from, const struct type *from_type,
+       floatformat_from_doublest (to_fmt, &d, to);
+     }
+ }
+-
+-const struct floatformat *floatformat_ieee_single[BFD_ENDIAN_UNKNOWN];
+-const struct floatformat *floatformat_ieee_double[BFD_ENDIAN_UNKNOWN];
+-const struct floatformat *floatformat_ieee_quad[BFD_ENDIAN_UNKNOWN];
+-const struct floatformat *floatformat_arm_ext[BFD_ENDIAN_UNKNOWN];
+-const struct floatformat *floatformat_ia64_spill[BFD_ENDIAN_UNKNOWN];
+-
+-extern void _initialize_doublest (void);
+-
+-extern void
+-_initialize_doublest (void)
+-{
+-  floatformat_ieee_single[BFD_ENDIAN_LITTLE] = &floatformat_ieee_single_little;
+-  floatformat_ieee_single[BFD_ENDIAN_BIG] = &floatformat_ieee_single_big;
+-  floatformat_ieee_double[BFD_ENDIAN_LITTLE] = &floatformat_ieee_double_little;
+-  floatformat_ieee_double[BFD_ENDIAN_BIG] = &floatformat_ieee_double_big;
+-  floatformat_arm_ext[BFD_ENDIAN_LITTLE]
+-    = &floatformat_arm_ext_littlebyte_bigword;
+-  floatformat_arm_ext[BFD_ENDIAN_BIG] = &floatformat_arm_ext_big;
+-  floatformat_ia64_spill[BFD_ENDIAN_LITTLE] = &floatformat_ia64_spill_little;
+-  floatformat_ia64_spill[BFD_ENDIAN_BIG] = &floatformat_ia64_spill_big;
+-  floatformat_ieee_quad[BFD_ENDIAN_LITTLE] = &floatformat_ia64_quad_little;
+-  floatformat_ieee_quad[BFD_ENDIAN_BIG] = &floatformat_ia64_quad_big;
+-}
+diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
+index d19c593..dd2ef96 100644
+--- a/gdb/gdbtypes.c
++++ b/gdb/gdbtypes.c
+@@ -108,8 +108,8 @@ const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN] = {
+   &floatformat_vax_d
+ };
+ const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN] = {
+-  &floatformat_ibm_long_double,
+-  &floatformat_ibm_long_double
++  &floatformat_ibm_long_double_big,
++  &floatformat_ibm_long_double_little
+ };
+ /* Should opaque types be resolved?  */
+-- 
+1.7.1
+
index 5dbb0b01c661654d51077fe877aa43a20241994c..fa7e561fe3dbba9802d16ac458966dcbec1ab5b0 100644 (file)
--- a/gdb.spec
+++ b/gdb.spec
@@ -21,7 +21,7 @@ Summary(zh_TW.UTF-8): [.-A開發]C和.$)B其.-A他語.$)B言的調試器
 %define                snap    20120926
 Name:          gdb
 Version:       7.6.1
-Release:       1
+Release:       2
 License:       GPL v3+
 Group:         Development/Debuggers
 Source0:       http://ftp.gnu.org/gnu/gdb/%{name}-%{version}.tar.bz2
@@ -36,6 +36,7 @@ Patch103:     gdb-6.6-buildid-locate-core-as-arg.patch
 Patch104:      gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
 Patch105:      gdb-6.3-gstack-20050411.patch
 Patch106:      gdb-gdb-add-index-script.patch
+Patch107:      floatformat_ibm_long_double.patch
 Patch1000:     %{name}-readline.patch
 Patch1001:     %{name}-info.patch
 Patch1002:     %{name}-passflags.patch
@@ -176,6 +177,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
+%patch107 -p1
 
 %patch1000 -p1
 %patch1001 -p1
This page took 0.080051 seconds and 4 git commands to generate.