Skip to content

Commit d288a87

Browse files
rgdoliveiraCommit Bot
authored andcommitted
Fix build on PPC arch with musl
Some C libraries, notably Musl, define the regs member as a void pointer, hence we need to use the gp_regs member instead. Change-Id: I1ca2dbdba79a03ff81c25438c87c767d7a7cece4 Reviewed-on: https://chromium-review.googlesource.com/602327 Reviewed-by: Jaideep Bajwa <[email protected]> Reviewed-by: Ulan Degenbaev <[email protected]> Commit-Queue: Ulan Degenbaev <[email protected]> Cr-Commit-Position: refs/heads/master@{#47481}
1 parent f160520 commit d288a87

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/libsampler/sampler.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,18 @@ void SignalHandler::FillRegisterState(void* context, RegisterState* state) {
450450
state->sp = reinterpret_cast<void*>(mcontext.gregs[29]);
451451
state->fp = reinterpret_cast<void*>(mcontext.gregs[30]);
452452
#elif V8_HOST_ARCH_PPC
453+
#if V8_LIBC_GLIBC
453454
state->pc = reinterpret_cast<void*>(ucontext->uc_mcontext.regs->nip);
454455
state->sp =
455456
reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R1]);
456457
state->fp =
457458
reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R31]);
459+
#else
460+
// Some C libraries, notably Musl, define the regs member as a void pointer
461+
state->pc = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[32]);
462+
state->sp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[1]);
463+
state->fp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[31]);
464+
#endif
458465
#elif V8_HOST_ARCH_S390
459466
#if V8_TARGET_ARCH_32_BIT
460467
// 31-bit target will have bit 0 (MSB) of the PSW set to denote addressing

0 commit comments

Comments
 (0)