From 99b8c76f52558a1522f8ecc9efef7b3633656c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 15 Mar 2016 12:51:50 +0100 Subject: run_erl: Don't define _XOPEN_SOURCE on OS X On MacOS X, defining _XOPEN_SOURCE usually *removes* features from header files. Therefore, we should not set _XOPEN_SOURCE to 600 since that will remove the prototype for vsyslog(). Setting it to an empty value or not including it will ensure that the vsyslog() prototype is included. --- erts/etc/unix/run_erl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'erts') diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c index 44efb975ba..22302d539a 100644 --- a/erts/etc/unix/run_erl.c +++ b/erts/etc/unix/run_erl.c @@ -42,9 +42,14 @@ # include "config.h" #endif #ifdef HAVE_WORKING_POSIX_OPENPT -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 -#endif +# ifndef _XOPEN_SOURCE + /* On OS X, we must leave _XOPEN_SOURCE undefined in order for + * the prototype of vsyslog() to be included. + */ +# ifndef __APPLE__ +# define _XOPEN_SOURCE 600 +# endif +# endif #endif #include #include -- cgit v1.2.3 From b0421f3d267a99da21466050fd5715b7869f38c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 15 Mar 2016 08:10:32 +0100 Subject: configure.in: Fix compilation error in ethread.c 3121171f56c2 made warnings for missing prototypes into compilation errors. That broke building on MacOS X, because prototypes for the pthread_getname_np() and pthread_setname_np() functions included by ethread.c are missing. The prototypes for those functions *are* located in pthread.h, but are not included if _XOPEN_SOURCE is defined. Therefore, we must undefine _XOPEN_SOURCE. 6e606582a6 is the commit that started to define _XOPEN_SOURCE on MacOS X in order to mend floating-point exceptions. Since fp exceptions again are broken and disabled by default, it is safe to remove the definition of _XOPEN_SOURCE. --- erts/configure.in | 3 --- 1 file changed, 3 deletions(-) (limited to 'erts') diff --git a/erts/configure.in b/erts/configure.in index 021780ecc2..854bdbdc15 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -476,9 +476,6 @@ case $host_os in # -D_WIN32_WINNT=* from CPPFLAGS is saved in ETHR_DEFS. CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600 -DWINVER=0x0600" ;; - darwin*) - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE" - ;; *) ;; esac -- cgit v1.2.3 From 395fbd8d02cb314b8ae57b9c02b4293037ca6890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 15 Mar 2016 08:31:27 +0100 Subject: 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. --- erts/configure.in | 38 -------------------------------------- erts/emulator/sys/unix/sys_float.c | 26 +++----------------------- 2 files changed, 3 insertions(+), 61 deletions(-) (limited to 'erts') 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 - #include - #include - #include - #include - #include - #include - ],[ - #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; -- cgit v1.2.3