This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
RFC: Structure alignment patch for GCC 3.x
- To: cygwin-apps <cygwin-apps at cygwin dot com>
- Subject: RFC: Structure alignment patch for GCC 3.x
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- Date: Sat, 25 Aug 2001 20:21:21 +1000 (EST)
Hello
Changes in gcc/config/i386/i386.h (GCC 3.0.x) break compatbility with
"native" default 8-byte structure alignment.
This definition of BIGGEST_FIELD_ALIGNMENT in i386.h (GCC-3.0.1
release) 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
Unless -malign-double switch is used struct align defaults to 4-bytes.
This patch to cygwin.h will fix:
--- 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
Any comments before I submit to GCC patches.
Danny
_____________________________________________________________________________
http://shopping.yahoo.com.au - Father's Day Shopping
- Find the perfect gift for your Dad for Father's Day