diff options
-rw-r--r-- | Changes | 5 | ||||
-rw-r--r-- | Makefile.build_config.in | 4 | ||||
-rwxr-xr-x | configure | 10 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | otherlibs/win32unix/Makefile | 4 | ||||
-rw-r--r-- | testsuite/Makefile | 3 | ||||
-rw-r--r-- | utils/Makefile | 2 | ||||
-rw-r--r-- | utils/config.mlp | 4 |
8 files changed, 30 insertions, 9 deletions
@@ -453,6 +453,11 @@ OCaml 4.12.0 - #10008: Improve error message for aliases to the current compilation unit. (Leo White, review by Gabriel Scherer) +- #10046: Link all DLLs with -static-libgcc on mingw32 to prevent dependency + on libgcc_s_sjlj-1.dll with mingw-w64 runtime 8.0.0 (previously this was + only needed for dllunix.dll). + (David Allsopp, report by Andreas Hauptmann, review by ???) + ### Internal/compiler-libs changes: - #8987: Make some locations more accurate diff --git a/Makefile.build_config.in b/Makefile.build_config.in index fa6b2b71e3..49a3f14c0c 100644 --- a/Makefile.build_config.in +++ b/Makefile.build_config.in @@ -27,3 +27,7 @@ INSTALL_PROG ?= @INSTALL_PROGRAM@ # The command to generate C dependency information DEP_CC=@DEP_CC@ -MM COMPUTE_DEPS=@compute_deps@ + +# This is munged into utils/config.ml, not overridable by other parts of +# the build system. +OC_DLL_LDFLAGS=@oc_dll_ldflags@ @@ -803,6 +803,7 @@ ocamlc_cppflags ocamlc_cflags nativecclibs bytecclibs +oc_dll_ldflags oc_ldflags oc_cppflags oc_cflags @@ -2780,6 +2781,7 @@ internal_cppflags="" ocamlc_cflags="" ocamlc_cppflags="" oc_ldflags="" +oc_dll_ldflags="" with_sharedlibs=true ostype="Unix" iflexdir="" @@ -2886,6 +2888,7 @@ VERSION=4.13.0+dev0-2020-10-19 + # TODO: rename this variable @@ -12783,7 +12786,7 @@ fi if $with_sharedlibs; then : case $host in #( i686-*-*) : - flexdll_chain="mingw" ;; #( + flexdll_chain="mingw"; oc_dll_ldflags="-static-libgcc" ;; #( x86_64-*-*) : flexdll_chain="mingw64" ;; #( *) : @@ -13629,6 +13632,11 @@ if test x"$enable_shared" != "xno"; then : *-*-mingw32) : mksharedlib='$(FLEXLINK)' mkmaindll='$(FLEXLINK) -maindll' + if test -n "$oc_dll_ldflags"; then : + + mksharedlib="$mksharedlib -link \"$oc_dll_ldflags\"" + mkmaindll="$mkmaindll -link \"$oc_dll_ldflags\"" +fi shared_libraries_supported=$with_sharedlibs ;; #( *-pc-windows) : mksharedlib='$(FLEXLINK)' diff --git a/configure.ac b/configure.ac index c1e52891e3..f1c90241a1 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,7 @@ internal_cppflags="" ocamlc_cflags="" ocamlc_cppflags="" oc_ldflags="" +oc_dll_ldflags="" with_sharedlibs=true ostype="Unix" iflexdir="" @@ -108,6 +109,7 @@ AC_SUBST([toolchain]) AC_SUBST([oc_cflags]) AC_SUBST([oc_cppflags]) AC_SUBST([oc_ldflags]) +AC_SUBST([oc_dll_ldflags]) AC_SUBST([bytecclibs]) AC_SUBST([nativecclibs]) AC_SUBST([ocamlc_cflags]) @@ -679,7 +681,7 @@ AS_CASE([$CC,$host], [*,*-*-mingw32], [AS_IF([$with_sharedlibs], [AS_CASE([$host], - [i686-*-*], [flexdll_chain="mingw"], + [i686-*-*], [flexdll_chain="mingw"; oc_dll_ldflags="-static-libgcc"], [x86_64-*-*], [flexdll_chain="mingw64"]) flexlink="flexlink -chain $flexdll_chain -merge-manifest -stack 16777216" flexdir=`$flexlink -where | tr -d '\015'` @@ -822,6 +824,9 @@ AS_IF([test x"$enable_shared" != "xno"], [*-*-mingw32], [mksharedlib='$(FLEXLINK)' mkmaindll='$(FLEXLINK) -maindll' + AS_IF([test -n "$oc_dll_ldflags"],[ + mksharedlib="$mksharedlib -link \"$oc_dll_ldflags\"" + mkmaindll="$mkmaindll -link \"$oc_dll_ldflags\""]) shared_libraries_supported=$with_sharedlibs], [*-pc-windows], [mksharedlib='$(FLEXLINK)' diff --git a/otherlibs/win32unix/Makefile b/otherlibs/win32unix/Makefile index 0d6fafea34..149b8e9382 100644 --- a/otherlibs/win32unix/Makefile +++ b/otherlibs/win32unix/Makefile @@ -54,11 +54,7 @@ unixLabels.cmi: \ include ../Makefile.otherlibs.common -ifeq "$(SYSTEM)" "mingw" -LDOPTS=-ldopt "-link -static-libgcc" $(addprefix -ldopt ,$(WIN32_LIBS)) -else LDOPTS=$(addprefix -ldopt ,$(WIN32_LIBS)) -endif clean:: rm -f $(UNIX_FILES) $(UNIX_CAML_FILES) diff --git a/testsuite/Makefile b/testsuite/Makefile index 6ca578464b..d7fc326ea3 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -58,8 +58,9 @@ else ifeq "$(FLEXLINK_ENV)" "" ocamltest := MKDLL="$(MKDLL)" SORT=$(SORT) MAKE=$(MAKE) $(ocamltest_program) else + FLEXLINK_DLL_LDFLAGS=$(if $(OC_DLL_LDFLAGS), -link "$(OC_DLL_LDFLAGS)") MKDLL=$(WINTOPDIR)/boot/ocamlrun $(WINTOPDIR)/flexdll/flexlink.exe \ - $(FLEXLINK_FLAGS) + $(FLEXLINK_FLAGS) $(FLEXLINK_DLL_LDFLAGS) ocamltest := $(FLEXLINK_ENV) MKDLL="$(MKDLL)" SORT=$(SORT) MAKE=$(MAKE) \ $(ocamltest_program) diff --git a/utils/Makefile b/utils/Makefile index 871fc2fe59..11e2cebe2e 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -39,6 +39,7 @@ SUBST_QUOTE2=\ SUBST_QUOTE=$(call SUBST_QUOTE2,$1,$($1)) FLEXLINK_LDFLAGS=$(if $(OC_LDFLAGS), -link "$(OC_LDFLAGS)") +FLEXLINK_DLL_LDFLAGS=$(if $(OC_DLL_LDFLAGS), -link "$(OC_DLL_LDFLAGS)") config.ml: config.mlp $(ROOTDIR)/Makefile.config Makefile sed $(call SUBST,AFL_INSTRUMENT) \ @@ -64,6 +65,7 @@ config.ml: config.mlp $(ROOTDIR)/Makefile.config Makefile $(call SUBST_STRING,MKDLL) \ $(call SUBST_STRING,MKEXE) \ $(call SUBST_STRING,FLEXLINK_LDFLAGS) \ + $(call SUBST_STRING,FLEXLINK_DLL_LDFLAGS) \ $(call SUBST_STRING,MKMAINDLL) \ $(call SUBST,MODEL) \ $(call SUBST_STRING,NATIVECCLIBS) \ diff --git a/utils/config.mlp b/utils/config.mlp index 10df2bdbe7..5bfa30d694 100644 --- a/utils/config.mlp +++ b/utils/config.mlp @@ -65,9 +65,9 @@ let mkdll, mkexe, mkmaindll = let c = flexlink.[i] in if c = '/' then '\\' else c in (String.init (String.length flexlink) f) ^ " %%FLEXLINK_FLAGS%%" in - flexlink, + flexlink ^ "%%FLEXLINK_DLL_LDFLAGS%%", flexlink ^ " -exe%%FLEXLINK_LDFLAGS%%", - flexlink ^ " -maindll" + flexlink ^ " -maindll%%FLEXLINK_DLL_LDFLAGS%%" with Not_found -> "%%MKDLL%%", "%%MKEXE%%", "%%MKMAINDLL%%" else |