diff options
author | Mikael Pettersson <[email protected]> | 2015-11-14 11:45:01 +0100 |
---|---|---|
committer | Mikael Pettersson <[email protected]> | 2015-11-14 11:49:07 +0100 |
commit | 3d42f1aac27268652c17972051f303f35b035e70 (patch) | |
tree | bfeaa24add14c522aa0d6ba41f6ef8da800c6450 /erts/emulator | |
parent | 0db6272323fd662cb43f5bb4d24f01daa8a6647d (diff) | |
download | otp-3d42f1aac27268652c17972051f303f35b035e70.tar.gz otp-3d42f1aac27268652c17972051f303f35b035e70.tar.bz2 otp-3d42f1aac27268652c17972051f303f35b035e70.zip |
hipe_x86_signal: add support for musl libc
- change #if tests at default Solaris case to explicitly check for __sun__
- add new default case, instantiate it for musl
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/hipe/hipe_x86_signal.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/erts/emulator/hipe/hipe_x86_signal.c b/erts/emulator/hipe/hipe_x86_signal.c index bb8a3f041f..69d4ea10c2 100644 --- a/erts/emulator/hipe/hipe_x86_signal.c +++ b/erts/emulator/hipe/hipe_x86_signal.c @@ -198,7 +198,7 @@ static void do_init(void) #define INIT() do { if (!init_done()) do_init(); } while (0) #endif /* __DARWIN__ */ -#if !defined(__GLIBC__) && !defined(__DARWIN__) && !defined(__NetBSD__) +#if defined(__sun__) /* * Assume Solaris/x86 2.8. * There is a number of sigaction() procedures in libc: @@ -232,7 +232,34 @@ static void do_init(void) } #define _NSIG NSIG #define INIT() do { if (!init_done()) do_init(); } while (0) -#endif /* not glibc or darwin */ +#endif /* __sun__ */ + +#if !(defined(__GLIBC__) || defined(__DARWIN__) || defined(__NetBSD__) || defined(__sun__)) +/* + * Unknown libc -- assume musl. Note: musl deliberately does not provide a musl-specific + * feature test macro, so we cannot check for it. + * + * sigaction is a weak alias for __sigaction, which is a wrapper for __libc_sigaction. + * There are libc-internal calls to __libc_sigaction which install handlers, so we must + * override __libc_sigaction rather than __sigaction. + */ +#include <dlfcn.h> +static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); +#define init_done() (__next_sigaction != 0) +#define __SIGACTION __libc_sigaction +static void do_init(void) +{ + __next_sigaction = dlsym(RTLD_NEXT, "__libc_sigaction"); + if (__next_sigaction != 0) + return; + perror("dlsym"); + abort(); +} +#ifndef _NSIG +#define _NSIG NSIG +#endif +#define INIT() do { if (!init_done()) do_init(); } while (0) +#endif /* !(__GLIBC__ || __DARWIN__ || __NetBSD__ || __sun__) */ #if !defined(__NetBSD__) /* |