diff options
author | Björn Gustavsson <[email protected]> | 2016-03-15 08:31:27 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-16 11:58:17 +0100 |
commit | 395fbd8d02cb314b8ae57b9c02b4293037ca6890 (patch) | |
tree | d532c2b5313fe3598ba0ea1cd3fb6b526e324bc7 | |
parent | b0421f3d267a99da21466050fd5715b7869f38c6 (diff) | |
download | otp-395fbd8d02cb314b8ae57b9c02b4293037ca6890.tar.gz otp-395fbd8d02cb314b8ae57b9c02b4293037ca6890.tar.bz2 otp-395fbd8d02cb314b8ae57b9c02b4293037ca6890.zip |
Take out (parts of) broken fp exception support for MacOS X
Floating-point exception support on MacOS X has never been especially
reliable, and has therefore been disabled by default for a long time.
The fpe support is now broken.
Therefore, take out the unnecessary test for modern mcontext in
configure (whatever that means) and the associated code in sys_float.c.
Add #error directives to sys_float.c to make it clear that
fpe is not supported.
It seems to risky to mess with the mess of #ifdef's, so we will
not attempt to remove all fpe support code for MacOS X.
-rw-r--r-- | erts/configure.in | 38 | ||||
-rw-r--r-- | erts/emulator/sys/unix/sys_float.c | 26 |
2 files changed, 3 insertions, 61 deletions
diff --git a/erts/configure.in b/erts/configure.in index 854bdbdc15..cae3843465 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -2807,44 +2807,6 @@ if test "$cross_compiling" != "yes" && test X${enable_hipe} != Xno; then fi fi -case $ARCH-$OPSYS in - amd64-darwin*|x86-darwin*) - AC_MSG_CHECKING([For modern (leopard) style mcontext_t]) - AC_TRY_COMPILE([ - #include <stdlib.h> - #include <sys/types.h> - #include <unistd.h> - #include <mach/mach.h> - #include <pthread.h> - #include <machine/signal.h> - #include <ucontext.h> - ],[ - #if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__) - #define __DARWIN__ 1 - #endif - - #ifndef __DARWIN__ - #error inpossible - #else - - mcontext_t mc = NULL; - int x = mc->__fs.__fpu_mxcsr; - - #endif - ],darwin_mcontext_leopard=yes, - darwin_mcontext_leopard=no) - if test X"$darwin_mcontext_leopard" = X"yes"; then - AC_DEFINE(DARWIN_MODERN_MCONTEXT,[],[Modern style mcontext_t in MacOSX]) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - ;; - *) - darwin_mcontext_leopard=no - ;; -esac - if test X${enable_fp_exceptions} = Xauto ; then case $host_os in *linux*) diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c index 8fe7e599e5..89e2484b17 100644 --- a/erts/emulator/sys/unix/sys_float.c +++ b/erts/emulator/sys/unix/sys_float.c @@ -499,18 +499,8 @@ static int mask_fpe(void) #define mc_pc(mc) ((mc)->gregs[REG_RIP]) #elif defined(__linux__) && defined(__i386__) #define mc_pc(mc) ((mc)->gregs[REG_EIP]) -#elif defined(__DARWIN__) && defined(__i386__) -#ifdef DARWIN_MODERN_MCONTEXT -#define mc_pc(mc) ((mc)->__ss.__eip) -#else -#define mc_pc(mc) ((mc)->ss.eip) -#endif -#elif defined(__DARWIN__) && defined(__x86_64__) -#ifdef DARWIN_MODERN_MCONTEXT -#define mc_pc(mc) ((mc)->__ss.__rip) -#else -#define mc_pc(mc) ((mc)->ss.rip) -#endif +#elif defined(__DARWIN__) +# error "Floating-point exceptions not supported on MacOS X" #elif defined(__FreeBSD__) && defined(__x86_64__) #define mc_pc(mc) ((mc)->mc_rip) #elif defined(__FreeBSD__) && defined(__i386__) @@ -575,17 +565,7 @@ static void fpe_sig_action(int sig, siginfo_t *si, void *puc) regs[PT_FPSCR] = 0x80|0x40|0x10; /* VE, OE, ZE; not UE or XE */ #endif #elif defined(__DARWIN__) && (defined(__i386__) || defined(__x86_64__)) -#ifdef DARWIN_MODERN_MCONTEXT - mcontext_t mc = uc->uc_mcontext; - pc = mc_pc(mc); - mc->__fs.__fpu_mxcsr = 0x1F80; - *(unsigned short *)&mc->__fs.__fpu_fsw &= ~0xFF; -#else - mcontext_t mc = uc->uc_mcontext; - pc = mc_pc(mc); - mc->fs.fpu_mxcsr = 0x1F80; - *(unsigned short *)&mc->fs.fpu_fsw &= ~0xFF; -#endif /* DARWIN_MODERN_MCONTEXT */ +# error "Floating-point exceptions not supported on MacOS X" #elif defined(__DARWIN__) && defined(__ppc__) mcontext_t mc = uc->uc_mcontext; pc = mc->ss.srr0; |