From 5da81682638fb00f9250c442ecc413b2984dce4e Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sat, 4 Feb 2017 21:33:53 +1100 Subject: allow non-default exception handling targets --- Makefile | 20 +++++++++++++++++++- README.md | 7 +++++++ docs/index.html | 4 ++++ src/gcc.mk | 4 +++- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 68b0fb6..ed91454 100644 --- a/Makefile +++ b/Makefile @@ -87,8 +87,26 @@ MXE_CONFIGURE_OPTS = \ --disable-static --enable-shared ) \ $(MXE_DISABLE_DOC_OPTS) +# GCC threads and exceptions MXE_GCC_THREADS = \ - $(if $(findstring posix,$(TARGET)),posix,win32) + $(if $(findstring posix,$(or $(TARGET),$(1))),posix,win32) + +# allowed exception handling for targets +# default (first item) and alternate, revisit if gcc/mingw-w64 change defaults +i686-w64-mingw32_EH := sjlj dw2 +x86_64-w64-mingw32_EH := seh sjlj + +# functions to determine exception handling from user-specified target +# $(or $(TARGET),$(1)) allows use as both function and inline snippet +TARGET_EH_LIST = $($(firstword $(call split,.,$(or $(TARGET),$(1))))_EH) +DEFAULT_EH = $(firstword $(TARGET_EH_LIST)) +GCC_EXCEPTIONS = \ + $(lastword $(DEFAULT_EH) \ + $(filter $(TARGET_EH_LIST),$(call split,.,$(or $(TARGET),$(1))))) +MXE_GCC_EXCEPTION_OPTS = \ + $(if $(call seq,sjlj,$(GCC_EXCEPTIONS)),--enable-sjlj-exceptions) \ + $(if $(call seq,dw2,$(GCC_EXCEPTIONS)),--disable-sjlj-exceptions) + # Append these to the "make" and "make install" steps of autotools packages # in order to neither build nor install unwanted binaries, manpages, diff --git a/README.md b/README.md index 16b4d45..37c4a20 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,12 @@ various target platforms, which: * GCC Threading Libraries (`winpthreads` is always available): - win32 - [posix (experimental)](https://github.com/mxe/mxe/pull/958) + * GCC Exception Handling: + - Default + - i686: sjlj + - x86_64: seh + - [Alternatives (experimental)](https://github.com/mxe/mxe/pull/1664) + - i686: dw2 + - x86_64: sjlj Please see [mxe.cc](http://mxe.cc/) for further information and package support matrix. diff --git a/docs/index.html b/docs/index.html index 6b298ba..b2961d3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -163,6 +163,10 @@ Experimental support for GCC with posix threads was added in November 2015.

+

+ Experimental support for alternate GCC Exception Handling was + added in February 2017. +

diff --git a/src/gcc.mk b/src/gcc.mk index 31e8d28..5186555 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -37,6 +37,7 @@ define $(PKG)_CONFIGURE --without-x \ --disable-win32-registry \ --enable-threads=$(MXE_GCC_THREADS) \ + $(MXE_GCC_EXCEPTION_OPTS) \ --enable-libgomp \ --with-gmp='$(PREFIX)/$(BUILD)' \ --with-isl='$(PREFIX)/$(BUILD)' \ @@ -45,7 +46,8 @@ define $(PKG)_CONFIGURE --with-as='$(PREFIX)/bin/$(TARGET)-as' \ --with-ld='$(PREFIX)/bin/$(TARGET)-ld' \ --with-nm='$(PREFIX)/bin/$(TARGET)-nm' \ - $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'") + $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'") \ + $($(PKG)_CONFIGURE_OPTS) endef define $(PKG)_BUILD_mingw-w64 -- cgit v0.12