[PATCH] Fix cygwin bootstrap failure

Roger Sayle roger@www.eyesopen.com
Wed Feb 26 06:39:00 GMT 2003


This patch broke mainline bootstrap on cygwin earlier today:

> Tue Feb 25 12:35:34 CET 2003  Jan Hubicka  <jh@suse.cz>
>
>        * Makefile.in (lcm.o):  Add dependency on function.h
>        * lcm.c (function.h): Include.
>        * i386.c (machine_function, ix86_stack_locals,
>        * ix86_save_varrargs_registers) : Move to ...
>        * i386.h (machine_function, ix86_stack_locals,
>        ix86_save_varrargs_registers): ... here; add
>	optimize_mode_switching
>        (ix86_optimize_mode_switching): New.
>        * i386.md (fix patterns): Set ix86_optimize_mode_switching


The problem concerns the move of machine_function to i386.h.  The
machine_function structure needs to be processed by the gengtype
machinery, or we abort during garbage collection because the machine
field of a "struct function" is non-null.

Previously, with i386's machine_function in i386.c, it'd be found
by gengtype.  Unfortunately, cygwin's tm_file only contains
cygwin.h, so the i386.h header file isn't scanned for GTY structures
under cygwin (but is under linux etc...).

The fix below is to remove the #include <i386/i386.h> from cygwin.h
and instead use the prefered tm_files = "${tm_files} cygwin.h" to
add it tm.h and expose the i386/i386.h header to GTFILES.  I've
checked that none of the macros defined in cygwin.h before including
i386/i386.h affect its behaviour upon inclusion, and similarly for
the macros defined in mingw32.h before including i386/cygwin.h.

I couldn't find anywhere in the Makefile fragments that listed the
cygwin.h dependency on i386.h, in which case this patch probably also
fixes potential dependency problems if i386.h is modified.


The following patch has been tested on i686-pc-cygwin where a complete
bootstrap, all languages except Ada and treelang, now proceeds to
completion.

Is this the appropriate fix?  Ok for mainline?


2003-02-25  Roger Sayle  <roger@eyesopen.com>

	* config/i386/cygwin.h: Don't directly include i386/i386.h.
	* config.gcc (cygwin, mingw32, uwin): Retain i386/i386.h in
	tm_files.


Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.284
diff -c -3 -p -r1.284 config.gcc
*** config.gcc	22 Feb 2003 23:46:45 -0000	1.284
--- config.gcc	26 Feb 2003 05:03:53 -0000
*************** i[34567]86-*-pe | i[34567]86-*-cygwin*)
*** 1312,1318 ****
  	xm_defines=POSIX
  	xm_file=i386/xm-cygwin.h
  	tmake_file=i386/t-cygwin
! 	tm_file=i386/cygwin.h
  	extra_objs=winnt.o
  	if test x$enable_threads = xyes; then
  		thread_file='win32'
--- 1312,1318 ----
  	xm_defines=POSIX
  	xm_file=i386/xm-cygwin.h
  	tmake_file=i386/t-cygwin
! 	tm_file="${tm_file} i386/cygwin.h"
  	extra_objs=winnt.o
  	if test x$enable_threads = xyes; then
  		thread_file='win32'
*************** i[34567]86-*-pe | i[34567]86-*-cygwin*)
*** 1320,1326 ****
  	exeext=.exe
  	;;
  i[34567]86-*-mingw32*)
! 	tm_file=i386/mingw32.h
  	xm_defines=POSIX
  	xm_file=i386/xm-mingw32.h
  	tmake_file="i386/t-cygwin i386/t-mingw32"
--- 1320,1326 ----
  	exeext=.exe
  	;;
  i[34567]86-*-mingw32*)
! 	tm_file="${tm_file} i386/mingw32.h"
  	xm_defines=POSIX
  	xm_file=i386/xm-mingw32.h
  	tmake_file="i386/t-cygwin i386/t-mingw32"
*************** i[34567]86-*-mingw32*)
*** 1338,1344 ****
  	esac
  	;;
  i[34567]86-*-uwin*)
! 	tm_file="i386/cygwin.h i386/uwin.h"
  	tmake_file="i386/t-cygwin i386/t-uwin"
  	extra_objs=winnt.o
  	if test x$enable_threads = xyes; then
--- 1338,1344 ----
  	esac
  	;;
  i[34567]86-*-uwin*)
! 	tm_file="${tm_file} i386/cygwin.h i386/uwin.h"
  	tmake_file="i386/t-cygwin i386/t-uwin"
  	extra_objs=winnt.o
  	if test x$enable_threads = xyes; then
Index: config/i386/cygwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/cygwin.h,v
retrieving revision 1.80
diff -c -3 -p -r1.80 cygwin.h
*** config/i386/cygwin.h	16 Feb 2003 06:27:19 -0000	1.80
--- config/i386/cygwin.h	26 Feb 2003 05:03:53 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 28,34 ****
  #define TARGET_EXECUTABLE_SUFFIX ".exe"

  #include <stdio.h>
- #include "i386/i386.h"
  #include "i386/unix.h"
  #include "i386/bsd.h"
  #include "i386/gas.h"
--- 28,33 ----

Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list