diff mbox series

[MinGW] Set __USE_MINGW_ACCESS for C++ as well

Message ID 20190303104156.8765-1-johannespfau@gmail.com
State New
Headers show
Series [MinGW] Set __USE_MINGW_ACCESS for C++ as well | expand

Commit Message

Johannes Pfau March 3, 2019, 10:41 a.m. UTC
We set __USE_MINGW_ACCESS for windows hosts to use MinGWs wrapper
for the access function. The wrapper ensures that access behaves
in the expected way (e.g. for special files, such as nul).
However, we now compile most sources with the C++ compiler and
the __USE_MINGW_ACCESS in CFLAGS is not used there. This causes
GCCs build against newer msvcrt versions with incompatible
access implementations to fail. This patch adds the flag to the
CXXFLAGS for all bootstrap stages. Bootstrapped on
x86_64-mingw64-seh.

config/ChangeLog:

2019-03-02  Johannes Pfau  <johannespfau@gmail.com>

	* mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.

---
 config/mh-mingw | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Johannes Pfau March 17, 2019, 12:29 p.m. UTC | #1
Am 03.03.19 um 11:41 schrieb Johannes Pfau:
> We set __USE_MINGW_ACCESS for windows hosts to use MinGWs wrapper
> for the access function. The wrapper ensures that access behaves
> in the expected way (e.g. for special files, such as nul).
> However, we now compile most sources with the C++ compiler and
> the __USE_MINGW_ACCESS in CFLAGS is not used there. This causes
> GCCs build against newer msvcrt versions with incompatible
> access implementations to fail. This patch adds the flag to the
> CXXFLAGS for all bootstrap stages. Bootstrapped on
> x86_64-mingw64-seh.
>
> config/ChangeLog:
>
> 2019-03-02  Johannes Pfau  <johannespfau@gmail.com>
>
> 	* mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.
>
> ---
>   config/mh-mingw | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/config/mh-mingw b/config/mh-mingw
> index bc1d27477d0..a795096f038 100644
> --- a/config/mh-mingw
> +++ b/config/mh-mingw
> @@ -2,6 +2,11 @@
>   # Vista (see PR33281 for details).
>   BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
>   CFLAGS += -D__USE_MINGW_ACCESS
> +STAGE1_CXXFLAGS += -D__USE_MINGW_ACCESS
> +STAGE2_CXXFLAGS += -D__USE_MINGW_ACCESS
> +STAGE3_CXXFLAGS += -D__USE_MINGW_ACCESS
> +STAGE4_CXXFLAGS += -D__USE_MINGW_ACCESS
> +
>   # Increase stack limit to a figure based on the Linux default, with 4MB added
>   # as GCC turns out to need that much more to pass all the limits-* tests.
>   LDFLAGS += -Wl,--stack,12582912


Ping. Would be great to get this into GCC as 
https://github.com/niXman/mingw-builds/ now has a --with-default-msvcrt= 
which simplifies building MinGW for a specific MSVC version a lot, but 
at least the bootstrap builds are currently blocked by this issue.


Best regards,

Johannes
Jonathan Yong March 18, 2019, 10:31 p.m. UTC | #2
On 3/3/19 10:41 AM, Johannes Pfau wrote:
> We set __USE_MINGW_ACCESS for windows hosts to use MinGWs wrapper
> for the access function. The wrapper ensures that access behaves
> in the expected way (e.g. for special files, such as nul).
> However, we now compile most sources with the C++ compiler and
> the __USE_MINGW_ACCESS in CFLAGS is not used there. This causes
> GCCs build against newer msvcrt versions with incompatible
> access implementations to fail. This patch adds the flag to the
> CXXFLAGS for all bootstrap stages. Bootstrapped on
> x86_64-mingw64-seh.
> 
> config/ChangeLog:
> 
> 2019-03-02  Johannes Pfau  <johannespfau@gmail.com>
> 
> 	* mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.
> 
> ---
>  config/mh-mingw | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/config/mh-mingw b/config/mh-mingw
> index bc1d27477d0..a795096f038 100644
> --- a/config/mh-mingw
> +++ b/config/mh-mingw
> @@ -2,6 +2,11 @@
>  # Vista (see PR33281 for details).
>  BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
>  CFLAGS += -D__USE_MINGW_ACCESS
> +STAGE1_CXXFLAGS += -D__USE_MINGW_ACCESS
> +STAGE2_CXXFLAGS += -D__USE_MINGW_ACCESS
> +STAGE3_CXXFLAGS += -D__USE_MINGW_ACCESS
> +STAGE4_CXXFLAGS += -D__USE_MINGW_ACCESS
> +
>  # Increase stack limit to a figure based on the Linux default, with 4MB added
>  # as GCC turns out to need that much more to pass all the limits-* tests.
>  LDFLAGS += -Wl,--stack,12582912
> 

Patch looks good, will apply soon.
Jonathan Yong March 19, 2019, 2:53 p.m. UTC | #3
On 3/18/19 10:31 PM, JonY wrote:
> On 3/3/19 10:41 AM, Johannes Pfau wrote:
>> We set __USE_MINGW_ACCESS for windows hosts to use MinGWs wrapper
>> for the access function. The wrapper ensures that access behaves
>> in the expected way (e.g. for special files, such as nul).
>> However, we now compile most sources with the C++ compiler and
>> the __USE_MINGW_ACCESS in CFLAGS is not used there. This causes
>> GCCs build against newer msvcrt versions with incompatible
>> access implementations to fail. This patch adds the flag to the
>> CXXFLAGS for all bootstrap stages. Bootstrapped on
>> x86_64-mingw64-seh.
>>
>> config/ChangeLog:
>>
>> 2019-03-02  Johannes Pfau  <johannespfau@gmail.com>
>>
>> 	* mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.
>>
>> ---
>>  config/mh-mingw | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/config/mh-mingw b/config/mh-mingw
>> index bc1d27477d0..a795096f038 100644
>> --- a/config/mh-mingw
>> +++ b/config/mh-mingw
>> @@ -2,6 +2,11 @@
>>  # Vista (see PR33281 for details).
>>  BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
>>  CFLAGS += -D__USE_MINGW_ACCESS
>> +STAGE1_CXXFLAGS += -D__USE_MINGW_ACCESS
>> +STAGE2_CXXFLAGS += -D__USE_MINGW_ACCESS
>> +STAGE3_CXXFLAGS += -D__USE_MINGW_ACCESS
>> +STAGE4_CXXFLAGS += -D__USE_MINGW_ACCESS
>> +
>>  # Increase stack limit to a figure based on the Linux default, with 4MB added
>>  # as GCC turns out to need that much more to pass all the limits-* tests.
>>  LDFLAGS += -Wl,--stack,12582912
>>
> 
> Patch looks good, will apply soon.
> 

Forgot to reply that this was checked in as r269784.
diff mbox series

Patch

diff --git a/config/mh-mingw b/config/mh-mingw
index bc1d27477d0..a795096f038 100644
--- a/config/mh-mingw
+++ b/config/mh-mingw
@@ -2,6 +2,11 @@ 
 # Vista (see PR33281 for details).
 BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
 CFLAGS += -D__USE_MINGW_ACCESS
+STAGE1_CXXFLAGS += -D__USE_MINGW_ACCESS
+STAGE2_CXXFLAGS += -D__USE_MINGW_ACCESS
+STAGE3_CXXFLAGS += -D__USE_MINGW_ACCESS
+STAGE4_CXXFLAGS += -D__USE_MINGW_ACCESS
+
 # Increase stack limit to a figure based on the Linux default, with 4MB added
 # as GCC turns out to need that much more to pass all the limits-* tests.
 LDFLAGS += -Wl,--stack,12582912