42 lines
1.5 KiB
Diff
42 lines
1.5 KiB
Diff
From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
|
|
Date: Sun, 30 Aug 2020 19:17:42 +0200
|
|
Subject: [PATCH] gcc-go: support libucontext
|
|
|
|
This patch allows using gcc-go with libucontext. For this purpose,
|
|
it unconditionally links gcc-go against -lucontext. Furthermore,
|
|
it undefines SETCONTEXT_CLOBBERS_TLS in proc.c to prevent usage
|
|
of makecontext/swapcontext feature that are not support by libucontext.
|
|
---
|
|
Makefile.in | 2 +-
|
|
libgo/runtime/proc.c | 4 ++++
|
|
2 files changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/Makefile.in b/Makefile.in
|
|
index 593495e1650..c3e5d489bc0 100644
|
|
--- a/Makefile.in
|
|
+++ b/Makefile.in
|
|
@@ -52801,7 +52801,7 @@ configure-target-libgo:
|
|
esac; \
|
|
module_srcdir=libgo; \
|
|
rm -f no-such-file || : ; \
|
|
- CONFIG_SITE=no-such-file $(SHELL) \
|
|
+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
|
|
$$s/$$module_srcdir/configure \
|
|
--srcdir=$${topdir}/$$module_srcdir \
|
|
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
|
|
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
|
|
index 3a30748d329..a987678fa84 100644
|
|
--- a/libgo/runtime/proc.c
|
|
+++ b/libgo/runtime/proc.c
|
|
@@ -66,6 +66,10 @@ static void gscanstack(G*);
|
|
|
|
__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
|
|
|
|
+/* libucontext does not seem to support tlsbase, undef the macro
|
|
+ * here to make sure we define initcontext and fixcontext as dummies. */
|
|
+#undef SETCONTEXT_CLOBBERS_TLS
|
|
+
|
|
#ifndef SETCONTEXT_CLOBBERS_TLS
|
|
|
|
static inline void
|