Hi,

 The following patch fixes a regression introduced by commit e128670e13
 ("Merge lib32 def files into lib-common def.in files").

 That commit merged lib32 and lib64 .def files into shared .def.in files
 and added @N stdcall suffixes, relying on a sed substitution in
 Makefile.am to strip them for non-i386 targets. However, when building
 in a Cygwin environment, the preprocessor emits '\r' characters in its
 output, which prevents sed from matching the end of line — leaving the
 @N suffix intact in the generated .def files.

 This causes symbols like WSACleanup to appear as WSACleanup@0 in the
 resulting .a libraries, breaking linking on 64-bit targets.

 The fix is to add a `tr -d '\r'` stage before sed in the lib64,
 libarm32, and libarm64 .def generation rules to normalize the CPP
 output before processing.

Liaiss
 ---

  Liaiss Merzougue (1):
    Tighten @ suffix stripping in lib-common to lib64 .def conversions

   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 57d16a83a..fd8203c4e 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -4464,13 +4464,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 | tr -d '\r' | sed -E 's/^([^ ]+)@[0-9]+(
|$$)/\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 | tr -d '\r' | sed -E 's/^([^ ]+)@[0-9]+(
|$$)/\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 | tr -d '\r' | sed -E 's/^([^ ]+)@[0-9]+(
|$$)/\1\2/' > $@

 # Don't compile these, but install as is:
 #
--
2.43.0

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

Reply via email to