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

Commit2f51f42

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 parent9e02e20 commit2f51f42

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
@@ -375,16 +375,22 @@ else
375375

376376
$(stlib): $(shlib) ;
377377

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

386392
$(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
387-
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib)
393+
$(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib)
388394
endif
389395

390396
endif # PORTNAME == cgywin

‎src/makefiles/Makefile.win32

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

7373
# Rule for building a shared library from a single .o file
7474
%.dll: %.o
75-
$(CC) $(CFLAGS) -shared -o $@ $< -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
75+
$(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