This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

PATCH: Fix 32->64 cross compilation



This patch (courtesy of Jim Wilson, with minor adjustments by me) is
alleged to restore the ability to perform 32->64 bit cross-compiles on
the branch.  It is known to be a) ugly and b) defective in that it
you will get a differently-behaving compiler depending on whether you
are compiling from a 32-bit host or a 64-bit host.  (For example, you
will not be able to use TImode from a 32-bit host, even if that makes
sense on the target, and you could from a 64-bit host.)

It is believed that this is roughly the situation we were in with GCC
2.95.2, and so we have restored that functionality, which the SC
deemed vital for the release.  Everyone agrees that Alexandre's
improvements on the mainline are a better way to go overall; that will
be the approach for GCC 3.1.

I am not 100% confident that this works.  I have tried it with a
x86->sparc64 cross, and verified that some stuff seemed OK, but I
didn't try to build the entire toolchain.  I did also test that it
didn't break an x86 native build.

If you are in a position to be more sure, please let me know.  I will
assume all is well unless I hear otherwise soon, and so close the
corresponding PR.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-05-20  Mark Mitchell  <mark@codesourcery.com>
            Jim Wilson  <wilson@redhat.com>
	
	* libgcc2.h (TItype): Do not assume that the host has 64-bit ntegers.
	(W_TYPE_SIZE): Likewise.

Index: libgcc2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/libgcc2.h,v
retrieving revision 1.14.2.1
diff -c -p -r1.14.2.1 libgcc2.h
*** libgcc2.h	2001/04/25 00:04:38	1.14.2.1
--- libgcc2.h	2001/05/21 04:08:00
*************** typedef unsigned int USItype	__attribute
*** 94,100 ****
  /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
  typedef		 int DItype	__attribute__ ((mode (DI)));
  typedef unsigned int UDItype	__attribute__ ((mode (DI)));
! #if MIN_UNITS_PER_WORD > 4
  /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
  typedef		 int TItype	__attribute__ ((mode (TI)));
  typedef unsigned int UTItype	__attribute__ ((mode (TI)));
--- 94,102 ----
  /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
  typedef		 int DItype	__attribute__ ((mode (DI)));
  typedef unsigned int UDItype	__attribute__ ((mode (DI)));
! /* We cannot represent a TItype constant on a machine with 32-bit
!    HOST_WIDE_INTs, so it doesn't make sense to define these types.  */
! #if MIN_UNITS_PER_WORD > 4 && HOST_BITS_PER_WIDE_INT >= 64
  /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
  typedef		 int TItype	__attribute__ ((mode (TI)));
  typedef unsigned int UTItype	__attribute__ ((mode (TI)));
*************** typedef int word_type __attribute__ ((mo
*** 153,159 ****
  #define float bogus_type
  #define double bogus_type
  
! #if MIN_UNITS_PER_WORD > 4
  #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
  #define Wtype	DItype
  #define UWtype	UDItype
--- 155,163 ----
  #define float bogus_type
  #define double bogus_type
  
! /* We can only support a Wtype that fits within a HOST_WIDE_INT.  Otherwise,
!    DWtype overflows the tree and RTL types.  */
! #if MIN_UNITS_PER_WORD > 4 && HOST_BITS_PER_WIDE_INT >= 64
  #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
  #define Wtype	DItype
  #define UWtype	UDItype


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