From aaeb2facbc01d2ef0b02f536e14a7dbbac9d0e55 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 21 Jan 2021 14:13:32 +0100 Subject: [PATCH] gcc: patch gccgo on musl to allow usage of freestanding libucontext --- srcpkgs/gcc/files/gccgo-musl.patch | 22 ++++++++++++++++++++++ srcpkgs/gcc/template | 5 ----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/srcpkgs/gcc/files/gccgo-musl.patch b/srcpkgs/gcc/files/gccgo-musl.patch index 9b3f3af9b7f..a2ce4b2b046 100644 --- a/srcpkgs/gcc/files/gccgo-musl.patch +++ b/srcpkgs/gcc/files/gccgo-musl.patch @@ -1,6 +1,9 @@ This is not among the normal patches as these changes are musl specific and there is no way to easily conditionalize it in source for some of the changes. +Added by q66: runtime.h now uses libucontext_ prefixed APIs to allow build +with freestanding versions of libucontext + Souurce: Adélie Linux, q66 URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc @@ -186,6 +189,25 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc { mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; int i; +--- libgo/runtime/runtime.h ++++ libgo/runtime/runtime.h +@@ -500,10 +500,13 @@ int __go_setcontext(__go_context_t*); + void __go_makecontext(__go_context_t*, void (*)(), void*, size_t); + #else + #define __go_context_t ucontext_t +-#define __go_getcontext(c) getcontext(c) +-#define __go_setcontext(c) setcontext(c) ++int libucontext_getcontext(__go_context_t *); ++void libucontext_makecontext(__go_context_t *, void (*)(), int, ...); ++int libucontext_setcontext(const __go_context_t *); ++#define __go_getcontext(c) libucontext_getcontext(c) ++#define __go_setcontext(c) libucontext_setcontext(c) + #define __go_makecontext(c, fn, sp, size) \ +- ((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0)) ++ ((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, libucontext_makecontext(c, fn, 0)) + #endif + + // Symbols defined by the linker. --- libgo/sysinfo.c +++ libgo/sysinfo.c @@ -73,9 +73,6 @@ diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template index a346b50d56d..f7fa99383b1 100644 --- a/srcpkgs/gcc/template +++ b/srcpkgs/gcc/template @@ -46,11 +46,6 @@ case "$XBPS_TARGET_MACHINE" in mips*-musl|ppc*) _have_gccgo=no ;; esac -# FIXME -if [ -n "$CROSS_BUILD" -a "$XBPS_TARGET_LIBC" = "musl" ]; then - _have_gccgo=no -fi - if [ "$CHROOT_READY" ]; then hostmakedepends="tar texinfo perl flex" else