Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit284590e

Browse files
committed
MinGW: Use -static-libgcc when linking a DLL.
When commit846e91e switched the linkerdriver from dlltool/dllwrap to gcc, it became possible for linking tochoose shared libgcc. Backends having loaded a module dynamicallylinked to libgcc can exit abnormally, which the postmaster treats like acrash. Resume use of static libgcc exclusively, like 9.3 and earlier.Back-patch to 9.4.
1 parent53566fc commit284590e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

‎src/Makefile.shlib

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,22 @@ else
371371

372372
$(stlib): $(shlib) ;
373373

374+
# XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit
375+
# uncleanly, hence -static-libgcc. (Last verified with MinGW-w64 compilers
376+
# from i686-4.9.1-release-win32-dwarf-rt_v3-rev1.) Shared libgcc has better
377+
# support for C++/Java exceptions; while core PostgreSQL does not use them, it
378+
# would be nice to support shared libgcc for the benefit of extensions.
379+
#
374380
# If SHLIB_EXPORTS is set, the rules below will build a .def file from that.
375381
# Else we just use --export-all-symbols.
376382
ifeq (,$(SHLIB_EXPORTS))
377383
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
378-
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib)
384+
$(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib)
379385
else
380386
DLL_DEFFILE = lib$(NAME)dll.def
381387

382388
$(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
383-
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib)
389+
$(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib)
384390
endif
385391

386392
endif # PORTNAME == cgywin

‎src/makefiles/Makefile.win32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ win32ver.o: win32ver.rc
7676

7777
# Rule for building a shared library from a single .o file
7878
%.dll: %.o $(WIN32RES)
79-
$(CC) $(CFLAGS) -shared -o $@ $^ -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
79+
$(CC) $(CFLAGS) -shared -static-libgcc -o $@ $^ -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp