diff options
author | Zandra <[email protected]> | 2015-12-04 10:22:20 +0100 |
---|---|---|
committer | Zandra <[email protected]> | 2015-12-04 10:22:20 +0100 |
commit | fc571c1a5d505902c15742e7c0db60288d63fcdb (patch) | |
tree | 6e2cfa5ceedf71184d42cdb740739d2f009773e6 /erts/emulator | |
parent | 2124579786928996cfd81e58df4615247af5cd79 (diff) | |
parent | 3d42f1aac27268652c17972051f303f35b035e70 (diff) | |
download | otp-fc571c1a5d505902c15742e7c0db60288d63fcdb.tar.gz otp-fc571c1a5d505902c15742e7c0db60288d63fcdb.tar.bz2 otp-fc571c1a5d505902c15742e7c0db60288d63fcdb.zip |
Merge branch 'mikpe/hipe_x86_signal-musl-support' into maint
* mikpe/hipe_x86_signal-musl-support:
hipe_x86_signal: add support for musl libc
OTP-13159
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__) /* |