On Windows, a native C preprocessor outputs CRLF line endings. When using a
native toolchain in Cygwin, the Cygwin sed takes only LF line endings, so these
regular expressions fail to match stdcall suffixes for non-i686 targets.

This commit addresses the issue by allowing these regular expressions to match
an optional CR at EOL.

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/59337512/
Reported-by: Liaiss Merzougue <[email protected]>
Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-crt/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index cfb429f9a..fd0d10d94 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -4467,13 +4467,13 @@ lib32/%.def: lib-common/%.def.in
        $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGS32) $< -Wp,-w -P 
-I$(top_srcdir)/def-include > $@
  lib64/%.def: lib-common/%.def.in
- $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGS64) $< -Wp,-w -P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' > $@ + $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGS64) $< -Wp,-w -P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |\r?$$)/\1\2/' > $@
  libarm32/%.def: lib-common/%.def.in
- $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM32) $< -Wp,-w -P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' > $@ + $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM32) $< -Wp,-w -P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |\r?$$)/\1\2/' > $@
  libarm64/%.def: lib-common/%.def.in
- $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM64) $< -Wp,-w -P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' > $@ + $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM64) $< -Wp,-w -P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |\r?$$)/\1\2/' > $@
  # Don't compile these, but install as is:
 #
--
2.54.0

From 86da9a00d2bd0b45b57f6dc278638771a2ee7586 Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Fri, 22 May 2026 15:05:47 +0800
Subject: [PATCH] crt: Ignore CR at EOL when generating DEF files

On Windows, a native C preprocessor outputs CRLF line endings. When using a
native toolchain in Cygwin, the Cygwin sed takes only LF line endings, so these
regular expressions fail to match stdcall suffixes for non-i686 targets.

This commit addresses the issue by allowing these regular expressions to match
an optional CR at EOL.

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/59337512/
Reported-by: Liaiss Merzougue <[email protected]>
Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-crt/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index cfb429f9a..fd0d10d94 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -4467,13 +4467,13 @@ lib32/%.def: lib-common/%.def.in
        $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGS32) $< -Wp,-w -P 
-I$(top_srcdir)/def-include > $@
 
 lib64/%.def: lib-common/%.def.in
-       $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGS64) $< -Wp,-w -P 
-I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' > $@
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGS64) $< -Wp,-w -P 
-I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |\r?$$)/\1\2/' > $@
 
 libarm32/%.def: lib-common/%.def.in
-       $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM32) $< -Wp,-w 
-P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' > $@
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM32) $< -Wp,-w 
-P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |\r?$$)/\1\2/' > $@
 
 libarm64/%.def: lib-common/%.def.in
-       $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM64) $< -Wp,-w 
-P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' > $@
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && $(CPP) -x c $(CPPFLAGSARM64) $< -Wp,-w 
-P -I$(top_srcdir)/def-include | sed -E 's/^([^ ]+)@[0-9]+( |\r?$$)/\1\2/' > $@
 
 # Don't compile these, but install as is:
 #
-- 
2.54.0

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to