From 8487ec25e1c8f73ca7dc31e5d648cb05eede0f14 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 30 Jan 2015 16:39:02 +0100 Subject: w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll. * src/Makefile.am (extra_ltoptions): New. (libgpg_error_la_LDFLAGS): Use it. -- Since gcc 4.8 there is a regression 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). As usual the gcc maintainers don't care about backward compatibility and declare that as some kind of compatibility fix and not as regression from 4.7 and all earlier versions. Signed-off-by: Werner Koch --- src/Makefile.am | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index b91876b..403f5d2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,6 +114,12 @@ SUFFIXES = .rc .lo gpg_error_res = versioninfo.lo no_undefined = -no-undefined export_symbols = -export-symbols gpg-error.def +# i686-w64-mingw32.gcc version 4.9.1 takes the long long helper +# functions from libgcc_s_sjlj-1.dll and not from a static libgcc. As +# a plain C program we do not use exception handler and thus there is +# no need to use this DLL. Thus we force gcc to link that statically. +extra_ltoptions = -XCClinker -static-libgcc + install-def-file: gpg-error.def -$(INSTALL) -d $(DESTDIR)$(libdir) @@ -136,6 +142,8 @@ arch_sources = posix-lock.c posix-lock-obj.h posix-thread.c gpg_error_res = no_undefined = export_symbols = +extra_ltoptions = + install-def-file: uninstall-def-file: @@ -154,7 +162,7 @@ endif libgpg_error_la_LDFLAGS = \ $(no_undefined) $(export_symbols) $(libgpg_error_vers_opt) \ - -version-info \ + $(extra_ltoptions) -version-info \ @LIBGPG_ERROR_LT_CURRENT@:@LIBGPG_ERROR_LT_REVISION@:@LIBGPG_ERROR_LT_AGE@ libgpg_error_la_SOURCES = gettext.h $(arch_sources) \ -- cgit v1.2.3