Skip to content

Commit 663f1a7

Browse files
authored
Link gcc helpers statically on MinGW (#488)
When compiling a 32bit dll with the mingw-w64 compiler, some 64bit integer arithmetic operations are implemented using functions from libgcc (e.g. __udivdi3 and __umoddi3 from libgcc_s_dw2-1.dll). This unexpected dependency is inconvenient for applications. The run-time dependency can be avoid by linking statically.
1 parent 3973449 commit 663f1a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ case $host in
123123
os="windows"
124124
threads="windows"
125125
win_implementation="mingw"
126+
LDFLAGS="${LDFLAGS} -static-libgcc"
126127
;;
127128
*-msys*)
128129
AC_MSG_RESULT([ (Windows back-end, using MSYS2)])
129130
backend="windows"
130131
os="windows"
131132
threads="windows"
132133
win_implementation="mingw"
134+
LDFLAGS="${LDFLAGS} -static-libgcc"
133135
;;
134136
*-cygwin*)
135137
AC_MSG_RESULT([ (Windows back-end, using Cygwin)])

0 commit comments

Comments
 (0)