Message ID | CAM43=SPUvOERCG3Z=68TPyWK5fd-Ba1-e+vjvONSLfWR405Shw@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | fix Ada bootstrap on Cygwin64 (PR bootstrap/94918) | expand |
> 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;") The mingw32.h change is kludgy but probably not worse than the current state so probably OK I guess (if some cygwin specialist could confirm that would be great though). > libgcc/ > > 2020-05-02 Mikael Pettersson <mikpelinux@gmail.com> > > PR bootstrap/94918 > > * unwind-generic.h (__SEH__): Prevent windows.h from including > x86intrin.h and emmintrin.h. Same comment here, I'll let someone review this part (and comment on the mingw32.h change at the same time since both are basically similar. > --- 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 > 16:36:44.485724702 +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/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 > 16:36:44.485724702 +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
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 --- 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
> > 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. OK, this part (s-oscons-tmplt.c) is actually already pending on our side and will be merged soon now that we're in stage 1, so we're good on that front. For the rest of the patch (mingw32.h and unwind-generic.h), I'll let a cygwin specialist comment/approve, it's OK with me on principle. > 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/libgnat/g-sercom__mingw.adb.~1~ 2020-04-30 22:51:33.000000000 +0200 +++ gcc-10.1.0-RC-20200430/gcc/ada/libgnat/g-sercom__mingw.adb 2020-05-02 16:36:49.565719571 +0200 @@ -103,6 +103,7 @@ package body GNAT.Serial_Communications is C_Name : constant String := String (Name) & ASCII.NUL; Success : BOOL; + HFile : HANDLE; pragma Unreferenced (Success); begin @@ -110,7 +111,7 @@ package body GNAT.Serial_Communications Success := CloseHandle (HANDLE (Port.H)); end if; - Port.H := CreateFileA + HFile := CreateFileA (lpFileName => C_Name (C_Name'First)'Address, dwDesiredAccess => GENERIC_READ or GENERIC_WRITE, dwShareMode => 0, @@ -118,6 +119,7 @@ package body GNAT.Serial_Communications dwCreationDisposition => OPEN_EXISTING, dwFlagsAndAttributes => 0, hTemplateFile => 0); + Port.H := Serial_Port_Descriptor (HFile); pragma Assert (INVALID_HANDLE_VALUE = -1); --- 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 16:36:44.485724702 +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/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 16:36:44.485724702 +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