PR11867, bignum operations

Alan Modra amodra@gmail.com
Tue Aug 3 15:04:00 GMT 2010


On Tue, Aug 03, 2010 at 09:33:48AM -0400, DJ Delorie wrote:
> 
> > 	* config/tc-m32c.c (md_number_to_chars): Call bigendian
> > 	form of number_to_chars, not littleendian.
> 
> m32c is a little endian chip.

So it is.  I checked the chip docs this time..
gas/configure.tgt had it as big, CGEN_ENDIAN_BIG is passed to
m32c_cgen_cpu_open and tc-m32c.h has #define TARGET_BYTES_BIG_ENDIAN 1.

The only one here I'm not sure about is the change to
CGEN_ENDIAN_LITTLE, so I won't apply this immediately.  Hopefully
someone can set me straight on that.

	* configure.tgt (m32c): Set endian=little.
	* config/tc-m32c.h (TARGET_BYTES_BIG_ENDIAN): Define as 0.
	* config/tc-m32c.c (md_number_to_chars): Revert last change.
	(md_begin): Pass CGEN_ENDIAN_LITTLE to m32c_cgen_cpu_open.

Index: gas/configure.tgt
===================================================================
RCS file: /cvs/src/src/gas/configure.tgt,v
retrieving revision 1.61
diff -u -p -r1.61 configure.tgt
--- gas/configure.tgt	23 Jul 2010 14:52:49 -0000	1.61
+++ gas/configure.tgt	3 Aug 2010 14:45:05 -0000
@@ -45,7 +45,7 @@ case ${cpu} in
   ip2k)			cpu_type=ip2k endian=big ;; 
   iq2000)		cpu_type=iq2000 endian=big ;; 
   lm32)			cpu_type=lm32 ;;
-  m32c)			cpu_type=m32c endian=big ;;
+  m32c)			cpu_type=m32c endian=little ;;
   m32r)			cpu_type=m32r endian=big ;;
   m32rle)		cpu_type=m32r endian=little ;;
   m5200)		cpu_type=m68k ;;
Index: gas/config/tc-m32c.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32c.c,v
retrieving revision 1.24
diff -u -p -r1.24 tc-m32c.c
--- gas/config/tc-m32c.c	3 Aug 2010 10:53:10 -0000	1.24
+++ gas/config/tc-m32c.c	3 Aug 2010 14:45:06 -0000
@@ -171,7 +171,7 @@ md_begin (void)
   /* Set the machine number and endian.  */
   gas_cgen_cpu_desc = m32c_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, cpu_mach,
 					  CGEN_CPU_OPEN_ENDIAN,
-					  CGEN_ENDIAN_BIG,
+					  CGEN_ENDIAN_LITTLE,
 					  CGEN_CPU_OPEN_ISAS, & m32c_isa,
 					  CGEN_CPU_OPEN_END);
 
@@ -1146,7 +1146,7 @@ m32c_force_relocation (fixS * fixp)
 void
 md_number_to_chars (char * buf, valueT val, int n)
 {
-  number_to_chars_bigendian (buf, val, n);
+  number_to_chars_littleendian (buf, val, n);
 }
 
 /* Turn a string in input_line_pointer into a floating point constant of type
Index: gas/config/tc-m32c.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32c.h,v
retrieving revision 1.9
diff -u -p -r1.9 tc-m32c.h
--- gas/config/tc-m32c.h	2 Sep 2009 07:24:20 -0000	1.9
+++ gas/config/tc-m32c.h	3 Aug 2010 14:45:06 -0000
@@ -28,7 +28,7 @@
 
 #define TARGET_FORMAT "elf32-m32c"
 
-#define TARGET_BYTES_BIG_ENDIAN 1
+#define TARGET_BYTES_BIG_ENDIAN 0
 
 #define md_end  m32c_md_end
 extern void m32c_md_end (void);

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list