[PATCH] fix Ada bootstrap on Cygwin64 (PR bootstrap/94918)

Mikael Pettersson mikpelinux@gmail.com
Sun May 3 14:49:04 GMT 2020


On Sat, May 2, 2020 at 9:46 PM Arnaud Charlet <charlet@adacore.com> wrote:
>
> > This fixes three compilation errors preventing bootstrap of gcc-10/11
> > with Ada on x86_64-pc-cygwin.  See PR bootstrap/94918 for details.
> >
> > Tested by bootstrapping on x86_64-pc-cygwin, and since it touches code
> > shared with mingw, also by building a cross to x86_64-w64-mingw32.
> >
> > Ok for master and gcc-10 branch?
>
> No, the libgnat/g-sercom__mingw.adb is wrong and isn't needed.
>
> If there is an issue, it would be in "s-oscons-tmplt.c" which is supposed
> to define Serial_Port_Descriptor as:
>
>    subtype Serial_Port_Descriptor is System.Win32.HANDLE;
>
> See:
>
> #if defined (__MINGW32__) || defined (__CYGWIN__)
> # define TARGET_OS "Windows"
> # define Serial_Port_Descriptor "System.Win32.HANDLE"
> TXT("with System.Win32;")

Thanks, the "|| defined(__CYGWIN__)" is missing so
Serial_Port_Descriptor becomes "int" on Cygwin, triggering the error.
Revised patch below, re-tested on Cygwin64.

This fixes three compilation errors preventing bootstrap of gcc-10/11
with Ada on x86_64-pc-cygwin.  See PR bootstrap/94918 for details.

Tested by bootstrapping on x86_64-pc-cygwin, and since it touches code
shared with mingw, also by building a cross to x86_64-w64-mingw32.

Ok for master and gcc-10 branch?

(I don't have commit rights, so I will need assistance with that.)

(The patch is also attached, since gmail _will_ corrupt this text.)

gcc/ada/

2020-05-03  Mikael Pettersson  <mikpelinux@gmail.com>

        PR bootstrap/94918

        * mingw32.h: Prevent windows.h from including emmintrin.h on Cygwin64.
        * s-oscons-tmplt.c (Serial_Port_Descriptor): Define as
        System.Win32.HANDLE also on Cygwin.

libgcc/

2020-05-03  Mikael Pettersson  <mikpelinux@gmail.com>

        PR bootstrap/94918

        * unwind-generic.h (__SEH__): Prevent windows.h from including
        x86intrin.h and emmintrin.h.

--- gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h.~1~        2020-04-30
22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h    2020-05-02
17:18:44.196573200 +0200
@@ -56,6 +56,7 @@
 /* Note: windows.h on cygwin-64 includes x86intrin.h which uses malloc.
    That fails to compile, if malloc is poisoned, i.e. if !IN_RTS.  */
 #define _X86INTRIN_H_INCLUDED
+#define _EMMINTRIN_H_INCLUDED
 #endif
 #include <windows.h>

--- gcc-10.1.0-RC-20200430/gcc/ada/s-oscons-tmplt.c.~1~ 2020-04-30
22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/s-oscons-tmplt.c     2020-05-03
11:06:32.958993300 +0200
@@ -261,7 +261,7 @@ main (void) {
 TXT("--  This is the version for " TARGET)
 TXT("")
 TXT("with Interfaces.C;")
-#if defined (__MINGW32__)
+#if defined (__MINGW32__) || defined (__CYGWIN__)
 # define TARGET_OS "Windows"
 # define Serial_Port_Descriptor "System.Win32.HANDLE"
 TXT("with System.Win32;")
--- gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h.~1~  2020-04-30
22:51:36.000000000 +0200
+++ gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h      2020-05-02
17:18:44.212239100 +0200
@@ -30,6 +30,8 @@

 #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 /* Only for _GCC_specific_handler.  */
+#define _X86INTRIN_H_INCLUDED
+#define _EMMINTRIN_H_INCLUDED
 #include <windows.h>
 #endif
-------------- next part --------------
--- gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h.~1~	2020-04-30 22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h	2020-05-02 17:18:44.196573200 +0200
@@ -56,6 +56,7 @@
 /* Note: windows.h on cygwin-64 includes x86intrin.h which uses malloc.
    That fails to compile, if malloc is poisoned, i.e. if !IN_RTS.  */
 #define _X86INTRIN_H_INCLUDED
+#define _EMMINTRIN_H_INCLUDED
 #endif
 #include <windows.h>
 
--- gcc-10.1.0-RC-20200430/gcc/ada/s-oscons-tmplt.c.~1~	2020-04-30 22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/s-oscons-tmplt.c	2020-05-03 11:06:32.958993300 +0200
@@ -261,7 +261,7 @@ main (void) {
 TXT("--  This is the version for " TARGET)
 TXT("")
 TXT("with Interfaces.C;")
-#if defined (__MINGW32__)
+#if defined (__MINGW32__) || defined (__CYGWIN__)
 # define TARGET_OS "Windows"
 # define Serial_Port_Descriptor "System.Win32.HANDLE"
 TXT("with System.Win32;")
--- gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h.~1~	2020-04-30 22:51:36.000000000 +0200
+++ gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h	2020-05-02 17:18:44.212239100 +0200
@@ -30,6 +30,8 @@
 
 #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 /* Only for _GCC_specific_handler.  */
+#define _X86INTRIN_H_INCLUDED
+#define _EMMINTRIN_H_INCLUDED
 #include <windows.h>
 #endif
 


More information about the Gcc-patches mailing list