Remove -static-libgcc link flag from mingw32 port (#1535)

* MPR#6411 revisited

Including -static-libgcc in all link instructions prevents C++ exceptions
from ever working. mmap.o is the only affected unit, since it needs
auxiliary functions to perform division of an __int64. A better fix is to
specify --static-libgcc only when building dllbigarray.dll and dllunix.dll
(since they both export versions of this primitive).

* Correct -static-libgcc error in README.win32.adoc

The instructions for the mingw64 port added in 600a93d amended the
sentence about -static-libgcc to include config/Makefile.mingw64. The
64-bit mingw port has never required or included this flag.
master
David Allsopp 2017-12-19 15:53:58 +01:00 committed by Xavier Leroy
parent 2cc67bb4e0
commit 410ba0b342
5 changed files with 18 additions and 11 deletions

View File

@ -82,6 +82,11 @@ Working version
### Runtime system:
- MPR#6411, GPR#1535: don't compile everything with -static-libgcc on mingw32,
only dllbigarray.dll and libbigarray.a. Allows the use of C++ libraries which
raise exceptions.
(David Allsopp)
- GPR#1431: remove ocamlrun dependencies on curses/terminfo/termcap C library
(Xavier Leroy, review by Daniel Bünzli)

View File

@ -294,12 +294,6 @@ bash or by adding Cygwin's bin directory (e.g. `C:\cygwin\bin`) to your `PATH`.
* The replay debugger is partially supported (no reverse execution).
* The default `config/Makefile.mingw` and `config/Makefile.mingw64` pass
`-static-libgcc` to the linker. For more information on this topic:
- http://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/Link-Options.html#Link-Options
- http://caml.inria.fr/mantis/view.php?id=6411
[[seflexdll]]
== FlexDLL
Although the core of FlexDLL is necessarily written in C, the `flexlink` program

View File

@ -133,7 +133,7 @@ FLEXLINK_CMD=flexlink
FLEXDLL_CHAIN=mingw
# FLEXLINK_FLAGS must be safe to insert in an OCaml string
# (see ocamlmklibconfig.ml in tools/Makefile)
FLEXLINK_FLAGS=-chain $(FLEXDLL_CHAIN) -stack 16777216 -link -static-libgcc
FLEXLINK_FLAGS=-chain $(FLEXDLL_CHAIN) -stack 16777216
FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS)
FLEXDIR:=$(shell $(FLEXLINK) -where 2>/dev/null)
ifeq ($(FLEXDIR),)

View File

@ -21,6 +21,10 @@ CAMLOBJS=bigarray.cmo
include ../Makefile
ifeq "$(SYSTEM)" "mingw"
LDOPTS=-ldopt "-link -static-libgcc"
endif
mmap.$(O): ../$(UNIXLIB)/mmap.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(OUTPUTOBJ)$@ $<
mmap_ba.$(O): ../unix/mmap_ba.c

View File

@ -39,14 +39,12 @@ UNIX_FILES = access.c addrofstr.c chdir.c chmod.c cst2constr.c \
UNIX_CAML_FILES = unix.mli unixLabels.mli unixLabels.ml
ALL_FILES=$(WIN_FILES) $(UNIX_FILES)
WSOCKLIB=$(call SYSLIB,ws2_32)
ADVAPI32LIB=$(call SYSLIB,advapi32)
LIBNAME=unix
COBJS=$(ALL_FILES:.c=.$(O))
CAMLOBJS=unix.cmo unixLabels.cmo
LINKOPTS=-cclib $(WSOCKLIB) -cclib $(ADVAPI32LIB)
LDOPTS=-ldopt $(WSOCKLIB) -ldopt $(ADVAPI32LIB)
WIN32_LIBS=$(call SYSLIB,ws2_32) $(call SYSLIB,advapi32)
LINKOPTS=$(addprefix -cclib ,$(WIN32_LIBS))
EXTRACAMLFLAGS=-nolabels
EXTRACFLAGS=-I../unix
HEADERS=unixsupport.h socketaddr.h
@ -54,6 +52,12 @@ HEADERS=unixsupport.h socketaddr.h
include ../Makefile
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)