This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Sparc/Linux fixes part 1
- From: Michael Snyder <msnyder at redhat dot com>
- To: "David S. Miller" <davem at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 19 Apr 2002 18:25:32 -0700
- Subject: Re: [RFA] Sparc/Linux fixes part 1
- Organization: Red Hat, Inc.
- References: <20020419.144600.97361868.davem@redhat.com>
"David S. Miller" wrote:
>
> Ok, let's try to split up these changes even more in hopes
> someone might be able to start to look at least at the obvious
> bits.
>
> 32-bit Sparc under Linux does not have a 16-byte long double,
> this causes testsuite failures. Fix this by providing a
> SPARC_TARGET_LONG_DOUBLE_BYTES the OS specific target headers
> can override.
>
> Tested on sparc-linux-gnu, no regressions, a few new successes
> :-)
The idea is sound, but the implementation is not very
multi-arch-ish. Is there a runtime way to do this,
rather than by using a macro? The whole purpose of
multi-arch is that these decisions get made at runtime.
>
> 2002-04-19 David S. Miller <davem@redhat.com>
>
> * config/sparc/tm-sparc.h (SPARC_TARGET_LONG_DOUBLE_BYTES): New.
> (TARGET_LONG_DOUBLE_BIT): Define in non-multi-arch case.
> * config/sparc/tm-linux.h (SPARC_TARGET_LONG_DOUBLE_BYTES):
> Override.
> * config/sparc/tm-sp64linux.h (SPARC_TARGET_LONG_DOUBLE_BYTES):
> Override.
> * sparc-tdep.c (sparc_gdbarch_init): Use
> SPARC_TARGET_LONG_DOUBLE_BYTES in set_gdbarch_long_double_bit
> call. Do it after GDB_TARGET_IS_SPARC64 has stabilized.
>
> --- ./config/sparc/tm-sparc.h.~1~ Mon Jan 28 20:42:44 2002
> +++ ./config/sparc/tm-sparc.h Fri Apr 19 13:55:48 2002
> @@ -137,6 +137,8 @@ extern int sparc_intreg_size (void);
> #endif
> #endif
>
> +#define SPARC_TARGET_LONG_DOUBLE_BYTES 16
> +
> #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
> /*
> * The following defines must go away for MULTI_ARCH
> @@ -175,6 +177,11 @@ extern int sparc_intreg_size (void);
> real way to know how big a register is. */
>
> #define REGISTER_SIZE 4
> +
> +/* Say how large a 'long double' is. */
> +
> +#define TARGET_LONG_DOUBLE_BIT \
> + (SPARC_TARGET_LONG_DOUBLE_BYTES * TARGET_CHAR_BIT)
>
> /* Number of machine registers */
>
> --- ./config/sparc/tm-linux.h.~1~ Sun Feb 24 14:56:07 2002
> +++ ./config/sparc/tm-linux.h Fri Apr 19 13:58:11 2002
> @@ -25,6 +25,9 @@
>
> #include "sparc/tm-sparc.h"
>
> +#undef SPARC_TARGET_LONG_DOUBLE_BYTES
> +#define SPARC_TARGET_LONG_DOUBLE_BYTES 8
> +
> #define SIGCONTEXT_PC_OFFSET 12
>
> #include "tm-linux.h"
> --- ./config/sparc/tm-sp64linux.h.~1~ Sun Feb 24 14:56:07 2002
> +++ ./config/sparc/tm-sp64linux.h Fri Apr 19 13:58:03 2002
> @@ -25,6 +25,10 @@ Foundation, Inc., 59 Temple Place - Suit
>
> #include "sparc/tm-sp64.h"
>
> +#undef SPARC_TARGET_LONG_DOUBLE_BYTES
> +#define SPARC_TARGET_LONG_DOUBLE_BYTES \
> + (GDB_TARGET_IS_SPARC64 ? 16 : 8)
> +
> #define SIGCONTEXT_PC_OFFSET 16 /* See asm-sparc64/sigcontext.h */
>
> /* We always want full V9 + Ultra VIS stuff... */
> --- ./sparc-tdep.c.~1~ Fri Apr 12 11:18:57 2002
> +++ ./sparc-tdep.c Fri Apr 19 13:57:40 2002
> @@ -2970,7 +2970,6 @@ sparc_gdbarch_init (struct gdbarch_info
> set_gdbarch_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info);
> set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
> set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> - set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
> set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
> set_gdbarch_max_register_raw_size (gdbarch, 8);
> set_gdbarch_max_register_virtual_size (gdbarch, 8);
> @@ -3114,6 +3113,11 @@ sparc_gdbarch_init (struct gdbarch_info
> tdep->call_dummy_call_offset = 148 + 4 * 5;
> break;
> }
> +
> + /* Set this after GDB_TARGET_IS_SPARC64 has stabilized. */
> + set_gdbarch_long_double_bit (gdbarch,
> + SPARC_TARGET_LONG_DOUBLE_BYTES
> + * TARGET_CHAR_BIT);
>
> /*
> * Settings that vary per-architecture: