void-packages/srcpkgs/mono/patches/musl-ppc.patch

33 lines
1.4 KiB
Diff

Musl does not include kernel headers.
Also, fix context handling for ppc32/musl.
--- mono/utils/mono-sigcontext.h
+++ mono/utils/mono-sigcontext.h
@@ -321,6 +321,8 @@ typedef struct ucontext {
#elif defined(__mono_ppc__)
+#include <asm/ptrace.h>
+
#if HAVE_UCONTEXT_H
#include <ucontext.h>
#endif
@@ -334,10 +336,17 @@ typedef struct ucontext {
#define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gp_regs [PT_NIP])
#define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gp_regs [PT_LNK])
#else
+#ifdef __GLIBC__
#define UCONTEXT_REG_Rn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->gregs [(n)])
#define UCONTEXT_REG_FPRn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->fpregs.fpregs [(n)])
#define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->gregs [PT_NIP])
#define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->gregs [PT_LNK])
+#else
+ #define UCONTEXT_REG_Rn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.gregs [(n)])
+ #define UCONTEXT_REG_FPRn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.fpregs.fpregs [(n)])
+ #define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gregs [PT_NIP])
+ #define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gregs [PT_LNK])
+#endif
#endif
#elif defined (__APPLE__) && defined (_STRUCT_MCONTEXT)
typedef struct __darwin_ucontext os_ucontext;