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]: Make 8-byte structure alignment default for win32 targets


Hello 
 
Changes in  gcc/config/i386/i386.h in GCC 3.x break compatability with
"native" default 8-byte structure alignment. In GCC-2.95.x, 8-byte
structure alignment is default for cygwin and mingw targets.


This definition of BIGGEST_FIELD_ALIGNMENT in config/i386/i386.h  is
responsible for the regression:

/* The published ABIs say that doubles should be aligned on word
   boundaries, so lower the aligment for structure fields unless
   -malign-double is set.  */
/* BIGGEST_FIELD_ALIGNMENT is also used in libobjc, where it must be
   constant.  Use the smaller value in that context.  */
#ifndef IN_TARGET_LIBS
#define BIGGEST_FIELD_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
#else
#define BIGGEST_FIELD_ALIGNMENT 32
#endif


After applying following patch to config/i386/cygwin.h, bootstrap of
GCC-3.0.1 on mingw produces 8-byte structure alignment as default:

ChangeLog

2001-08-28  Danny Smith  <dannysmith@users.sourceforge.net>

    * config/i386/cygwin.h (BIGGEST_FIELD_ALIGNMENT): Set to 64. 



--- cygwin.h.orig	Fri Jun 22 18:27:34 2001
+++ cygwin.h	Sat Aug 25 21:35:19 2001
@@ -563,6 +563,11 @@ extern int i386_pe_dllimport_name_p PARA
 #undef	BIGGEST_ALIGNMENT
 #define BIGGEST_ALIGNMENT 128
 
+/* Native complier aligns internal doubles in structures on dword
boundaries.  */
+#undef	BIGGEST_FIELD_ALIGNMENT
+#define BIGGEST_FIELD_ALIGNMENT 64
+
+
 /* A bitfield declared as `int' forces `int' alignment for the struct.
 */
 #undef PCC_BITFIELDS_TYPE_MATTERS
 #define PCC_BITFIELDS_TYPE_MATTERS 1

 


_____________________________________________________________________________
http://shopping.yahoo.com.au - Father's Day Shopping
- Find the perfect gift for your Dad for Father's Day


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