This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/rfc] Default TARGET_LONG_DOUBLE_BIT to 64


(Pointed out by Richard.E.)

The attached changes the default value of TARGET_LONG_DOUBLE to 64.  It 
was 128.

This means that ``long double'' will have had two changes:

FORMAT floatformat_unknown -> floatformat_ieee_double
BIT 128 -> 64

I greped through the sources and found:

config/i386/tm-i386.h:#define TARGET_LONG_DOUBLE_FORMAT 
&floatformat_i387_ext
config/i386/tm-i386.h:#define TARGET_LONG_DOUBLE_BIT 96

Ok.

config/i386/tm-i386mk.h:   #define TARGET_LONG_DOUBLE_FORMAT 
TARGET_DOUBLE_FORMAT
config/i386/tm-i386mk.h:   #define TARGET_LONG_DOUBLE_BIT TARGET_DOUBLE_BIT

Ok.

config/i386/tm-i386mk.h:#undef TARGET_LONG_DOUBLE_FORMAT
config/i386/tm-i386mk.h:#undef TARGET_LONG_DOUBLE_BIT

Was broken (yes the same file).

config/i960/tm-i960.h:#define TARGET_LONG_DOUBLE_FORMAT 
&floatformat_i960_ext

Not sure.  Looking at the floatformat, it probably should be 96 but gets 
away with it because the actual value is in the first few bytes.

config/m68k/tm-m68k.h:#define TARGET_LONG_DOUBLE_FORMAT 
&floatformat_m68881_ext
config/m68k/tm-m68k.h:#define TARGET_LONG_DOUBLE_BIT 96

Ok.

config/mn10200/tm-mn10200.h:#undef TARGET_LONG_DOUBLE_BIT
config/mn10200/tm-mn10200.h:#define TARGET_LONG_DOUBLE_BIT 32

Was broken -> didn't define the format.  Outch!

There are tests in sizeof.exp to check that GDB's and the target sizes 
match.  Looks like there should also be tests to ensure that GDB is 
correctly extracting and storing values :-(

Andrew
2002-02-11  Andrew Cagney  <ac131313@redhat.com>

	* gdbarch.sh (TARGET_LONG_DOUBLE_BIT): Default to 64.
	* gdbarch.h, gdbarch.c: Re-generate.

Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.107
diff -p -r1.107 gdbarch.c
*** gdbarch.c	2002/02/10 07:37:22	1.107
--- gdbarch.c	2002/02/11 16:58:04
*************** gdbarch_alloc (const struct gdbarch_info
*** 451,457 ****
    current_gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
    current_gdbarch->float_bit = 4*TARGET_CHAR_BIT;
    current_gdbarch->double_bit = 8*TARGET_CHAR_BIT;
!   current_gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT;
    current_gdbarch->ptr_bit = TARGET_INT_BIT;
    current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
    current_gdbarch->char_signed = -1;
--- 451,457 ----
    current_gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
    current_gdbarch->float_bit = 4*TARGET_CHAR_BIT;
    current_gdbarch->double_bit = 8*TARGET_CHAR_BIT;
!   current_gdbarch->long_double_bit = 8*TARGET_CHAR_BIT;
    current_gdbarch->ptr_bit = TARGET_INT_BIT;
    current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
    current_gdbarch->char_signed = -1;
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.81
diff -p -r1.81 gdbarch.h
*** gdbarch.h	2002/02/10 17:25:38	1.81
--- gdbarch.h	2002/02/11 16:58:06
*************** extern void set_gdbarch_double_bit (stru
*** 212,218 ****
  
  /* Default (value) for non- multi-arch platforms. */
  #if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_BIT)
! #define TARGET_LONG_DOUBLE_BIT (2*TARGET_DOUBLE_BIT)
  #endif
  
  extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
--- 212,218 ----
  
  /* Default (value) for non- multi-arch platforms. */
  #if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_BIT)
! #define TARGET_LONG_DOUBLE_BIT (8*TARGET_CHAR_BIT)
  #endif
  
  extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.115
diff -p -r1.115 gdbarch.sh
*** gdbarch.sh	2002/02/10 17:25:38	1.115
--- gdbarch.sh	2002/02/11 16:58:07
*************** v::TARGET_FLOAT_BIT:int:float_bit::::8 *
*** 393,399 ****
  # Number of bits in a double for the target machine.
  v::TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
  # Number of bits in a long double for the target machine.
! v::TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):2*TARGET_DOUBLE_BIT::0
  # For most targets, a pointer on the target and its representation as an
  # address in GDB have the same size and "look the same".  For such a
  # target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
--- 393,399 ----
  # Number of bits in a double for the target machine.
  v::TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
  # Number of bits in a long double for the target machine.
! v::TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
  # For most targets, a pointer on the target and its representation as an
  # address in GDB have the same size and "look the same".  For such a
  # target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]