w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.

* src/Makefile.am (extra_ltoptions): New.
(libgpgme_la_LDFLAGS): Use it.
(libgpgme_pthread_la_LDFLAGS): Ditto.
(libgpgme_glib_la_LDFLAGS): Ditto.
--

Since gcc 4.8 there is a regression in Mingw64 in that plain C
programs may link to libgcc_s.a which has a dependency on
libgcc_s_sjlj.dll.  This is for example triggered by using long long
arithmetic on a 32 bit Windows (e.g symbol __udivdi3).

Note that we don't use this patch for the Qt version which, as C++
programs, actually requires that DLL,

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-04-13 15:35:06 +02:00
parent 8cfcdfe556
commit 524dacfbb6
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -153,6 +153,7 @@ SUFFIXES = .rc .lo
gpgme_res = versioninfo.lo gpgme_res = versioninfo.lo
no_undefined = -no-undefined no_undefined = -no-undefined
export_symbols = -export-symbols $(srcdir)/gpgme.def export_symbols = -export-symbols $(srcdir)/gpgme.def
extra_ltoptions = -XCClinker -static-libgcc
install-def-file: install-def-file:
-$(INSTALL) -d $(DESTDIR)$(libdir) -$(INSTALL) -d $(DESTDIR)$(libdir)
@ -167,20 +168,22 @@ else
gpgme_res = gpgme_res =
no_undefined = no_undefined =
export_symbols = export_symbols =
extra_ltoptions =
install-def-file: install-def-file:
uninstall-def-file: uninstall-def-file:
gpgme_deps = gpgme_deps =
endif endif
libgpgme_la_LDFLAGS = $(no_undefined) $(export_symbols) \ libgpgme_la_LDFLAGS = $(no_undefined) $(export_symbols) $(extra_ltoptions) \
$(libgpgme_version_script_cmd) -version-info \ $(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps) libgpgme_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
@GPG_ERROR_LIBS@ @GPG_ERROR_LIBS@
libgpgme_pthread_la_LDFLAGS = $(no_undefined) $(export_symbols) \ libgpgme_pthread_la_LDFLAGS = \
$(no_undefined) $(export_symbols) $(extra_ltoptions) \
$(libgpgme_version_script_cmd) -version-info \ $(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers
@ -188,8 +191,9 @@ libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
-lpthread @GPG_ERROR_LIBS@ -lpthread @GPG_ERROR_LIBS@
if BUILD_W32_GLIB if BUILD_W32_GLIB
libgpgme_glib_la_LDFLAGS = $(no_undefined) \ libgpgme_glib_la_LDFLAGS = \
$(export_symbols) $(libgpgme_version_script_cmd) -version-info \ $(no_undefined) $(export_symbols) $(extra_ltoptions) \
$(libgpgme_version_script_cmd) -version-info \
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
libgpgme_glib_la_DEPENDENCIES = @LTLIBOBJS@ \ libgpgme_glib_la_DEPENDENCIES = @LTLIBOBJS@ \
$(srcdir)/libgpgme.vers $(gpgme_deps) $(srcdir)/libgpgme.vers $(gpgme_deps)