gcc: patch gccgo on musl to allow usage of freestanding libucontext

This commit is contained in:
Daniel Kolesa 2021-01-21 14:13:32 +01:00 committed by q66
parent ae06ba604c
commit aaeb2facbc
2 changed files with 22 additions and 5 deletions

View file

@ -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 @@

View file

@ -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