2022-10-01 00:30:53 +00:00
|
|
|
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
|
2020-09-04 19:21:25 +00:00
|
|
|
|
2022-10-01 00:30:53 +00:00
|
|
|
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.
|
2020-09-04 19:21:25 +00:00
|
|
|
---
|
2022-10-01 00:30:53 +00:00
|
|
|
Makefile.in | 2 +-
|
|
|
|
libgo/runtime/proc.c | 4 ++++
|
|
|
|
2 files changed, 5 insertions(+), 1 deletion(-)
|
2020-09-04 19:21:25 +00:00
|
|
|
|
|
|
|
diff --git a/Makefile.in b/Makefile.in
|
2022-10-01 00:30:53 +00:00
|
|
|
index 593495e1650..c3e5d489bc0 100644
|
2020-09-04 19:21:25 +00:00
|
|
|
--- a/Makefile.in
|
|
|
|
+++ b/Makefile.in
|
2022-10-01 00:30:53 +00:00
|
|
|
@@ -52801,7 +52801,7 @@ configure-target-libgo:
|
2020-09-04 19:21:25 +00:00
|
|
|
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} \
|
2022-10-01 00:30:53 +00:00
|
|
|
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
|