diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index a10a5ca94..f61ac6c32 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -806,7 +806,6 @@ OS_OBJS += $(OBJDIR)/erl_mseg.o \ $(OBJDIR)/erl_$(ERLANG_OSTYPE)_sys_ddll.o \ $(OBJDIR)/erl_mtrace_sys_wrap.o -HIPE_x86_darwin_OBJS=$(OBJDIR)/mach_override.o HIPE_x86_OS_OBJS=$(HIPE_x86_$(OPSYS)_OBJS) HIPE_x86_OBJS=$(OBJDIR)/hipe_x86.o $(OBJDIR)/hipe_x86_glue.o $(OBJDIR)/hipe_x86_bifs.o $(OBJDIR)/hipe_x86_signal.o $(OBJDIR)/hipe_x86_stack.o $(HIPE_x86_OS_OBJS) HIPE_amd64_OBJS=$(OBJDIR)/hipe_amd64.o $(OBJDIR)/hipe_amd64_glue.o $(OBJDIR)/hipe_amd64_bifs.o $(OBJDIR)/hipe_x86_signal.o $(OBJDIR)/hipe_x86_stack.o diff --git a/erts/emulator/hipe/hipe_x86_signal.c b/erts/emulator/hipe/hipe_x86_signal.c index 0a196d934..7f3d472ac 100644 --- a/erts/emulator/hipe/hipe_x86_signal.c +++ b/erts/emulator/hipe/hipe_x86_signal.c @@ -147,24 +147,30 @@ static void do_init(void) #if defined(__DARWIN__) /* - * Darwin appears to require code patching in order to catch - * and redirect calls to library functions. That functionality - * is implemented by the mach_override library. + * Assumes Mac OS X >= 10.3 (dlsym operations not available in 10.2 and + * earlier). + * + * The code below assumes that is is part of the main image (earlier + * in the load order than libSystem and certainly before any dylib + * that might use sigaction) -- a standard RTLD_NEXT caveat. + * + * _sigaction lives in /usr/lib/libSystem.B.dylib and can be found + * with the standard dlsym(RTLD_NEXT) call. The proviso on Mac OS X + * being that the symbol for dlsym doesn't include a leading '_'. + * + * The other _sigaction, _sigaction_no_bind I don't understand the purpose + * of and don't modify. */ -#include "mach_override.h" -static int my_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); +#include static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); #define init_done() (__next_sigaction != 0) +#define __SIGACTION _sigaction static void do_init(void) { - kern_return_t err; - - err = mach_override_ptr((void*)sigaction, - (void*)my_sigaction, - (void**)&__next_sigaction); - if (!err) + __next_sigaction = dlsym(RTLD_NEXT, "sigaction"); + if (__next_sigaction != 0) return; - perror("mach_override"); + perror("dlsym_darwin"); abort(); } #define _NSIG NSIG