|
Message-Id: <0cba4a364a78622a9334e1768ceea73066d6ce4b.1519243731.git.mschiffer@universe-factory.net> Date: Wed, 21 Feb 2018 21:19:39 +0100 From: Matthias Schiffer <mschiffer@...verse-factory.net> To: musl@...ts.openwall.com Subject: [PATCH] powerpc: make ucontext_t API match glibc In glibc, ucontext_t's uc_mcontext contains the uc_regs field, pointing at the actual mcontext_t at the end of the structure. Bring our definition in line with what glibc does to allow builing libunwind. --- Note that this fixes only one of the two problems arising when building libunwind on PPC with musl. The other is that libunwind needs register definitions from Linux's asm/ptrace.h, which is pulled in through sys/user.h in glibc. As asm/ptrace.h contains a conflicting pt_regs definition, I've patched this into libunwind itself now in my OpenWrt tree: https://git.openwrt.org/?p=openwrt/staging/neoraider.git;a=blob;f=package/libs/libunwind/patches/004-ppc-registers-musl.patch arch/powerpc/bits/signal.h | 7 ++++--- arch/powerpc/pthread_arch.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h index 06efb11cf271..f842f5b82985 100644 --- a/arch/powerpc/bits/signal.h +++ b/arch/powerpc/bits/signal.h @@ -64,10 +64,11 @@ typedef struct __ucontext { struct __ucontext *uc_link; stack_t uc_stack; int uc_pad[7]; - mcontext_t *uc_regs; + struct { + mcontext_t *uc_regs; + } uc_mcontext; sigset_t uc_sigmask; - int uc_pad2[3]; - mcontext_t uc_mcontext; + char uc_pad2[12 + sizeof(mcontext_t)]; } ucontext_t; #define SA_NOCLDSTOP 1U diff --git a/arch/powerpc/pthread_arch.h b/arch/powerpc/pthread_arch.h index 7c5c4fadb211..8791ec5deb56 100644 --- a/arch/powerpc/pthread_arch.h +++ b/arch/powerpc/pthread_arch.h @@ -17,6 +17,6 @@ static inline struct pthread *__pthread_self() // the kernel calls the ip "nip", it's the first saved value after the 32 // GPRs. -#define MC_PC gregs[32] +#define MC_PC uc_regs->gregs[32] #define CANARY canary_at_end -- 2.16.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.