]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.2065: GvimExt cannot be linked statically using MinGW v9.1.2065
authorMuraoka Taro <koron.kaoriya@gmail.com>
Thu, 8 Jan 2026 20:12:58 +0000 (20:12 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 8 Jan 2026 20:12:58 +0000 (20:12 +0000)
Problem:  When building GvimExt with MinGW, some DLLs are still linked
          even if STATIC_STDCPLUS=yes is set.
Solution: Following the Vim core, make some libraries explicitly
          statically linked.  The order of libraries is important, and
          gcc_eh must be placed before winpthread (Muraoka Taro)

closes: #19131

Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/GvimExt/Make_ming.mak
src/version.c

index 06ec7b6dc517d2bb82490fab48f71b69dcf6afff..b73e6fd92a697e731aba9917d7396bd262ff879f 100644 (file)
@@ -22,10 +22,22 @@ MINGWOLD = no
 STATIC_STDCPLUS=no
 #STATIC_STDCPLUS=yes
 
+# If you use TDM-GCC(-64), change HAS_GCC_EH to "no".
+# This is used when STATIC_STDCPLUS=yes.
+HAS_GCC_EH=yes
+
+STATIC_LIBS=
+
 # Note: -static-libstdc++ is not available until gcc 4.5.x.
 LDFLAGS += -shared
 ifeq (yes, $(STATIC_STDCPLUS))
 LDFLAGS += -static-libgcc -static-libstdc++
+# Order important: gcc_eh must be placed before winpthread
+STATIC_LIBS += -lstdc++ -lgcc
+ ifeq (yes, $(HAS_GCC_EH))
+STATIC_LIBS += -lgcc_eh
+ endif
+STATIC_LIBS += -lwinpthread
 endif
 
 ifeq ($(CROSS),yes)
@@ -71,7 +83,8 @@ $(DLL): $(OBJ) $(RES) $(DEFFILE)
                -Wl,--whole-archive \
                        $^ \
                -Wl,--no-whole-archive \
-                       $(LIBS)
+                       $(LIBS) \
+               -Wl,-Bstatic $(STATIC_LIBS) -Wl,-Bdynamic
 
 gvimext.o: gvimext.cpp
        $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@
index b6a5fa5a178ed8b3c9d7081dbd18a9bfe7e904b9..45a660d0bb5d902f3563759de2ea2631e92b2fbb 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2065,
 /**/
     2064,
 /**/