[Patch] for PR target/33774: Support >8 byte field alignment on mingw/cyygwin targets

Danny Smith dannysmith@clear.net.nz
Mon Oct 15 02:15:00 GMT 2007


The followin fixes PR target/33774 by removing the 64-bit
BIGGEST_FIELD_ALIGNMENT restriction in cygming.h, except when building
libobjc. This brings the Windows32 targets into line with other i386
targets in support for vector modes.

Since GNU as (2.18) is currently unable to handle greater than 16 byte
alignment on PE-COFF, we avoid the 64-byte alignment tests in the gcc
and g++ struct-layout tests.


Tested on i686-pc-mingw32
Target: mingw32
Configured with: ../src/configure --enable-libgomp --host=mingw32
--build=mingw32 --target=mingw32 --with-arch=i486 --with-cpu=generic
--disable-werror --prefix=/mingw --enable-threads --disable-nls
--enable-languages=c,c++,fortran --disable-win32-registry
--enable-libstdcxx-debug --enable-cxx-flags='-fno-function-sections
-fno-data-sections' --enable-version-specific-runtime-lib
--disable-sjlj-exceptions --enable-shared --disable-symvers


:ADDPATCH windows32:

ChangeLog

2007-10-15  Danny Smith  <dannysmith@users.sourceforge.net>

	PR target/33774
	* config/i386/cygming.h (BIGGEST_FIELD_ALIGNMENT): Define only
if
	IN_TARGET_LIBS.

ChangeLog/testsuite
	* gcc.dg/compat/struct-layout-1.h: Avoid linker bug with
	>16-byte alignment on mingw32 and cygwin.
	* g++.dg/compat/struct-layout-1.h: Likewise.


Index:
===================================================================
--- config/i386/cygming.h	(revision 129243)
+++ config/i386/cygming.h	(working copy)
@@ -332,9 +332,13 @@
 #undef MAX_OFILE_ALIGNMENT
 #define MAX_OFILE_ALIGNMENT (8192 * 8)
 
-/* Native complier aligns internal doubles in structures on dword
boundaries.  */
+/* BIGGEST_FIELD_ALIGNMENT macro is used directly by libobjc.  There,
we
+   align internal doubles in structures on dword boundaries.
Otherwise,
+   support vector modes using ADJUST_FIELD_ALIGN, defined in i386.h.
*/
+#ifdef IN_TARGET_LIBS
 #undef	BIGGEST_FIELD_ALIGNMENT
 #define BIGGEST_FIELD_ALIGNMENT 64
+#endif
 
 /* A bit-field declared as `int' forces `int' alignment for the struct.
*/
 #undef PCC_BITFIELD_TYPE_MATTERS
Index: testsuite/gcc.dg/compat/struct-layout-1.h
===================================================================
--- testsuite/gcc.dg/compat/struct-layout-1.h	(revision 129243)
+++ testsuite/gcc.dg/compat/struct-layout-1.h	(working copy)
@@ -57,8 +57,10 @@
 typedef int __m64;
 typedef int __m128;
 #endif
-#if defined (__uClinux__)
-/* The maximum achievable alignment on uClinux is usually 16 bytes.  */
+#if defined (__uClinux__) || defined (__MINGW32__) || defined
(__CYGWIN__)
+/* The maximum achievable alignment on uClinux is usually 16 bytes.
+   On PE-COFF targets, GNU as (version 2.18) only supports alignment up
+   to 16 bytes, */
 #define v16sf v4sf
 #define u16sf u4sf
 #endif
Index: testsuite/g++.dg/compat/struct-layout-1.h
===================================================================
--- testsuite/g++.dg/compat/struct-layout-1.h	(revision 129243)
+++ testsuite/g++.dg/compat/struct-layout-1.h	(working copy)
@@ -57,8 +57,10 @@
 typedef int __m64;
 typedef int __m128;
 #endif
-#if defined (__uClinux__)
-/* The maximum achievable alignment on uClinux is usually 16 bytes.  */
+#if defined (__uClinux__) || defined (__MINGW32__) || defined
(__CYGWIN__)
+/* The maximum achievable alignment on uClinux is usually 16 bytes.
+   On PE-COFF targets, GNU as (version 2.18) only supports alignment up
+   to 16 bytes, */
 #define v16sf v4sf
 #define u16sf u4sf
 #endif



More information about the Gcc-patches mailing list