aboutsummaryrefslogtreecommitdiffstats
path: root/community/nodejs-current/ppc-fix-musl-mcontext.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/nodejs-current/ppc-fix-musl-mcontext.patch')
-rw-r--r--community/nodejs-current/ppc-fix-musl-mcontext.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/community/nodejs-current/ppc-fix-musl-mcontext.patch b/community/nodejs-current/ppc-fix-musl-mcontext.patch
new file mode 100644
index 0000000000..640fb8ed05
--- /dev/null
+++ b/community/nodejs-current/ppc-fix-musl-mcontext.patch
@@ -0,0 +1,32 @@
+From: Gustavo Romero <gromero@br.ibm.com>
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 28 Mar 2017 01:51:00 +0200
+Subject: [PATCH] Fix compilation on PPC when libc musl is used instead of glibc
+
+Musl on Power does not define regs member as a pt_regs pointer type,
+hence it's necessary to use member gp_regs instead.
+
+Ported to nodejs 7.7.4 (jirutka)
+
+--- a/deps/v8/src/libsampler/sampler.cc
++++ b/deps/v8/src/libsampler/sampler.cc
+@@ -450,11 +450,19 @@
+ state->sp = reinterpret_cast<void*>(mcontext.gregs[29]);
+ state->fp = reinterpret_cast<void*>(mcontext.gregs[30]);
+ #elif V8_HOST_ARCH_PPC
++#if V8_LIBC_GLIBC
+ state->pc = reinterpret_cast<void*>(ucontext->uc_mcontext.regs->nip);
+ state->sp =
+ reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R1]);
+ state->fp =
+ reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R31]);
++#else
++ // Some C libraries, notably Musl, define the regs member as a void pointer,
++ // hence we use the gp_regs member instead.
++ state.pc = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[32]);
++ state.sp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[1]);
++ state.fp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[31]);
++#endif
+ #elif V8_HOST_ARCH_S390
+ #if V8_TARGET_ARCH_32_BIT
+ // 31-bit target will have bit 0 (MSB) of the PSW set to denote addressing