diff --git a/cross/gcc-aarch64/0033-gcc-go-link-to-libucontext.patch b/cross/gcc-aarch64/0033-gcc-go-link-to-libucontext.patch index 802295d3a..19886049d 100644 --- a/cross/gcc-aarch64/0033-gcc-go-link-to-libucontext.patch +++ b/cross/gcc-aarch64/0033-gcc-go-link-to-libucontext.patch @@ -1,42 +1,101 @@ -From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Sun, 30 Aug 2020 19:17:42 +0200 -Subject: [PATCH] gcc-go: support libucontext +From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001 +From: Ian Lance Taylor +Date: Mon, 19 Dec 2022 10:37:06 -0800 +Subject: [PATCH] libgo: check for makecontext in -lucontext +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit -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. +Patch from Sören Tempel. + +Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722 +Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396 +Reviewed-by: Cherry Mui +Reviewed-by: Than McIntosh --- - Makefile.in | 2 +- - libgo/runtime/proc.c | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) + libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++ + libgo/configure.ac | 3 +++ + 2 files changed, 60 insertions(+) -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*); +diff --git a/libgo/configure b/libgo/configure +index 460fdad7..a607dbff 100755 +--- a/libgo/configure ++++ b/libgo/configure +@@ -14818,6 +14818,63 @@ fi - __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 + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5 ++$as_echo_n "checking for library containing makecontext... " >&6; } ++if ${ac_cv_search_makecontext+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ + - #ifndef SETCONTEXT_CLOBBERS_TLS ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char makecontext (); ++int ++main () ++{ ++return makecontext (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' ucontext; do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_search_makecontext=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext ++ if ${ac_cv_search_makecontext+:} false; then : ++ break ++fi ++done ++if ${ac_cv_search_makecontext+:} false; then : ++ ++else ++ ac_cv_search_makecontext=no ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5 ++$as_echo "$ac_cv_search_makecontext" >&6; } ++ac_res=$ac_cv_search_makecontext ++if test "$ac_res" != no; then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++fi ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 + $as_echo_n "checking for library containing sched_yield... " >&6; } + if ${ac_cv_search_sched_yield+:} false; then : +diff --git a/libgo/configure.ac b/libgo/configure.ac +index 09554a37..a59aa091 100644 +--- a/libgo/configure.ac ++++ b/libgo/configure.ac +@@ -570,6 +570,9 @@ PTHREAD_LIBS= + AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread) + AC_SUBST(PTHREAD_LIBS) - static inline void ++dnl Test if -lucontext is required for makecontext. ++AC_SEARCH_LIBS([makecontext], [ucontext]) ++ + dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime. + AC_SEARCH_LIBS([sched_yield], [rt]) + AC_SEARCH_LIBS([nanosleep], [rt]) diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD index ecef93fc1..e4d743271 100644 --- a/cross/gcc-aarch64/APKBUILD +++ b/cross/gcc-aarch64/APKBUILD @@ -32,7 +32,7 @@ pkgver=${_pkgbase}_git${_pkgsnap} [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-aarch64 -pkgrel=5 +pkgrel=6 pkgdesc="Stage2 cross-compiler for aarch64" url="https://gcc.gnu.org" arch="x86_64" @@ -794,7 +794,7 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc 674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch 5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch -3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch +72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch 141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch diff --git a/cross/gcc-armhf/0033-gcc-go-link-to-libucontext.patch b/cross/gcc-armhf/0033-gcc-go-link-to-libucontext.patch index 802295d3a..19886049d 100644 --- a/cross/gcc-armhf/0033-gcc-go-link-to-libucontext.patch +++ b/cross/gcc-armhf/0033-gcc-go-link-to-libucontext.patch @@ -1,42 +1,101 @@ -From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Sun, 30 Aug 2020 19:17:42 +0200 -Subject: [PATCH] gcc-go: support libucontext +From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001 +From: Ian Lance Taylor +Date: Mon, 19 Dec 2022 10:37:06 -0800 +Subject: [PATCH] libgo: check for makecontext in -lucontext +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit -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. +Patch from Sören Tempel. + +Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722 +Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396 +Reviewed-by: Cherry Mui +Reviewed-by: Than McIntosh --- - Makefile.in | 2 +- - libgo/runtime/proc.c | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) + libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++ + libgo/configure.ac | 3 +++ + 2 files changed, 60 insertions(+) -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*); +diff --git a/libgo/configure b/libgo/configure +index 460fdad7..a607dbff 100755 +--- a/libgo/configure ++++ b/libgo/configure +@@ -14818,6 +14818,63 @@ fi - __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 + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5 ++$as_echo_n "checking for library containing makecontext... " >&6; } ++if ${ac_cv_search_makecontext+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ + - #ifndef SETCONTEXT_CLOBBERS_TLS ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char makecontext (); ++int ++main () ++{ ++return makecontext (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' ucontext; do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_search_makecontext=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext ++ if ${ac_cv_search_makecontext+:} false; then : ++ break ++fi ++done ++if ${ac_cv_search_makecontext+:} false; then : ++ ++else ++ ac_cv_search_makecontext=no ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5 ++$as_echo "$ac_cv_search_makecontext" >&6; } ++ac_res=$ac_cv_search_makecontext ++if test "$ac_res" != no; then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++fi ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 + $as_echo_n "checking for library containing sched_yield... " >&6; } + if ${ac_cv_search_sched_yield+:} false; then : +diff --git a/libgo/configure.ac b/libgo/configure.ac +index 09554a37..a59aa091 100644 +--- a/libgo/configure.ac ++++ b/libgo/configure.ac +@@ -570,6 +570,9 @@ PTHREAD_LIBS= + AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread) + AC_SUBST(PTHREAD_LIBS) - static inline void ++dnl Test if -lucontext is required for makecontext. ++AC_SEARCH_LIBS([makecontext], [ucontext]) ++ + dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime. + AC_SEARCH_LIBS([sched_yield], [rt]) + AC_SEARCH_LIBS([nanosleep], [rt]) diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD index cffa74d62..26c3d6f8d 100644 --- a/cross/gcc-armhf/APKBUILD +++ b/cross/gcc-armhf/APKBUILD @@ -32,7 +32,7 @@ pkgver=${_pkgbase}_git${_pkgsnap} [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-armhf -pkgrel=5 +pkgrel=6 pkgdesc="Stage2 cross-compiler for armhf" url="https://gcc.gnu.org" arch="x86_64" @@ -794,7 +794,7 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc 674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch 5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch -3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch +72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch 141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch diff --git a/cross/gcc-armv7/0033-gcc-go-link-to-libucontext.patch b/cross/gcc-armv7/0033-gcc-go-link-to-libucontext.patch index 802295d3a..19886049d 100644 --- a/cross/gcc-armv7/0033-gcc-go-link-to-libucontext.patch +++ b/cross/gcc-armv7/0033-gcc-go-link-to-libucontext.patch @@ -1,42 +1,101 @@ -From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Sun, 30 Aug 2020 19:17:42 +0200 -Subject: [PATCH] gcc-go: support libucontext +From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001 +From: Ian Lance Taylor +Date: Mon, 19 Dec 2022 10:37:06 -0800 +Subject: [PATCH] libgo: check for makecontext in -lucontext +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit -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. +Patch from Sören Tempel. + +Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722 +Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396 +Reviewed-by: Cherry Mui +Reviewed-by: Than McIntosh --- - Makefile.in | 2 +- - libgo/runtime/proc.c | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) + libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++ + libgo/configure.ac | 3 +++ + 2 files changed, 60 insertions(+) -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*); +diff --git a/libgo/configure b/libgo/configure +index 460fdad7..a607dbff 100755 +--- a/libgo/configure ++++ b/libgo/configure +@@ -14818,6 +14818,63 @@ fi - __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 + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5 ++$as_echo_n "checking for library containing makecontext... " >&6; } ++if ${ac_cv_search_makecontext+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ + - #ifndef SETCONTEXT_CLOBBERS_TLS ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char makecontext (); ++int ++main () ++{ ++return makecontext (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' ucontext; do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_search_makecontext=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext ++ if ${ac_cv_search_makecontext+:} false; then : ++ break ++fi ++done ++if ${ac_cv_search_makecontext+:} false; then : ++ ++else ++ ac_cv_search_makecontext=no ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5 ++$as_echo "$ac_cv_search_makecontext" >&6; } ++ac_res=$ac_cv_search_makecontext ++if test "$ac_res" != no; then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++fi ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 + $as_echo_n "checking for library containing sched_yield... " >&6; } + if ${ac_cv_search_sched_yield+:} false; then : +diff --git a/libgo/configure.ac b/libgo/configure.ac +index 09554a37..a59aa091 100644 +--- a/libgo/configure.ac ++++ b/libgo/configure.ac +@@ -570,6 +570,9 @@ PTHREAD_LIBS= + AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread) + AC_SUBST(PTHREAD_LIBS) - static inline void ++dnl Test if -lucontext is required for makecontext. ++AC_SEARCH_LIBS([makecontext], [ucontext]) ++ + dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime. + AC_SEARCH_LIBS([sched_yield], [rt]) + AC_SEARCH_LIBS([nanosleep], [rt]) diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD index 931155d6f..7e1759180 100644 --- a/cross/gcc-armv7/APKBUILD +++ b/cross/gcc-armv7/APKBUILD @@ -32,7 +32,7 @@ pkgver=${_pkgbase}_git${_pkgsnap} [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-armv7 -pkgrel=5 +pkgrel=6 pkgdesc="Stage2 cross-compiler for armv7" url="https://gcc.gnu.org" arch="x86_64" @@ -794,7 +794,7 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc 674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch 5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch -3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch +72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch 141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch diff --git a/cross/gcc-riscv64/0033-gcc-go-link-to-libucontext.patch b/cross/gcc-riscv64/0033-gcc-go-link-to-libucontext.patch index 802295d3a..19886049d 100644 --- a/cross/gcc-riscv64/0033-gcc-go-link-to-libucontext.patch +++ b/cross/gcc-riscv64/0033-gcc-go-link-to-libucontext.patch @@ -1,42 +1,101 @@ -From 0631e2b9453b33c42e12a14c11e8257d470016c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Sun, 30 Aug 2020 19:17:42 +0200 -Subject: [PATCH] gcc-go: support libucontext +From ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4 Mon Sep 17 00:00:00 2001 +From: Ian Lance Taylor +Date: Mon, 19 Dec 2022 10:37:06 -0800 +Subject: [PATCH] libgo: check for makecontext in -lucontext +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit -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. +Patch from Sören Tempel. + +Change-Id: I74b4052cc7aca19224afd6d9a2739c3fae46b722 +Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396 +Reviewed-by: Cherry Mui +Reviewed-by: Than McIntosh --- - Makefile.in | 2 +- - libgo/runtime/proc.c | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) + libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++ + libgo/configure.ac | 3 +++ + 2 files changed, 60 insertions(+) -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*); +diff --git a/libgo/configure b/libgo/configure +index 460fdad7..a607dbff 100755 +--- a/libgo/configure ++++ b/libgo/configure +@@ -14818,6 +14818,63 @@ fi - __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 + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing makecontext" >&5 ++$as_echo_n "checking for library containing makecontext... " >&6; } ++if ${ac_cv_search_makecontext+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ + - #ifndef SETCONTEXT_CLOBBERS_TLS ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char makecontext (); ++int ++main () ++{ ++return makecontext (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' ucontext; do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_search_makecontext=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext ++ if ${ac_cv_search_makecontext+:} false; then : ++ break ++fi ++done ++if ${ac_cv_search_makecontext+:} false; then : ++ ++else ++ ac_cv_search_makecontext=no ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_makecontext" >&5 ++$as_echo "$ac_cv_search_makecontext" >&6; } ++ac_res=$ac_cv_search_makecontext ++if test "$ac_res" != no; then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++fi ++ ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 + $as_echo_n "checking for library containing sched_yield... " >&6; } + if ${ac_cv_search_sched_yield+:} false; then : +diff --git a/libgo/configure.ac b/libgo/configure.ac +index 09554a37..a59aa091 100644 +--- a/libgo/configure.ac ++++ b/libgo/configure.ac +@@ -570,6 +570,9 @@ PTHREAD_LIBS= + AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread) + AC_SUBST(PTHREAD_LIBS) - static inline void ++dnl Test if -lucontext is required for makecontext. ++AC_SEARCH_LIBS([makecontext], [ucontext]) ++ + dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime. + AC_SEARCH_LIBS([sched_yield], [rt]) + AC_SEARCH_LIBS([nanosleep], [rt]) diff --git a/cross/gcc-riscv64/APKBUILD b/cross/gcc-riscv64/APKBUILD index 7ebf0f62a..3737a029c 100644 --- a/cross/gcc-riscv64/APKBUILD +++ b/cross/gcc-riscv64/APKBUILD @@ -32,7 +32,7 @@ pkgver=${_pkgbase}_git${_pkgsnap} [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-riscv64 -pkgrel=5 +pkgrel=6 pkgdesc="Stage2 cross-compiler for riscv64" url="https://gcc.gnu.org" arch="x86_64" @@ -794,7 +794,7 @@ b40d7e4712c035674c993bbb55475290ec14523b3f0fd05493514bac4e9adaa6641faf815fc40ffc 674360ce2ee9f704d0632cc98756f9fe8dd8ca30064fb9d3423b437f7e679c1c51e765b15e535dcb278cd2769583690acb3395b91e4fd5f6f4e3b97879fcc313 0027-always-build-libgcc_eh.a.patch f060687adcd5297124e4000f1ba1e3fd5d7d124da04d948cbd0d4a6c69a90a2b29a4a0dbbe13a83ab6950724f434de012b681bdbcdf53c0100b40fe3d00f2f2f 0028-ada-libgnarl-compatibility-for-musl.patch 5160bae68e20a1966c1f6d655ee98af759e9b9ee842718ae6007d467b418e1cf3b307528a0841477b5259671ce868521b06c0f2e947b7b8f3a398c53dd978252 0029-ada-musl-support-fixes.patch -3c04b26554a78096296ca9542c77a91219bd26044dd2cb2006db4c1944889a97c215900b3828ba7e8c675162406db543605a815bdfbd915bf810663b1b253bdd 0033-gcc-go-link-to-libucontext.patch +72631fbef4843d6ada52f3173b257e027605866a3faf1d8e34438cbf2581952f97bf6f9569ee44fcd7c4b3b337612eaeb0612fb2e6451903f219e4d99bf719db 0033-gcc-go-link-to-libucontext.patch 141c0428f988cbd102000d4db8d4150485f6da5c064469493ea378cd579bed99330658f41fe106c0d07d1c1aa436ec3f864403ed1ba79f791a1d727b42d46910 0034-Use-generic-errstr.go-implementation-on-musl.patch d9ba710f770e053c8f212e821817c188091a829658050b9ab5906388553ec60fec37943ea43c270e92a9014902949f3c98fc4639032d92b8145b375bb29e193e 0035-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch ab90d8fdd977d6cd3da096a1c76d77be3e89a020b2127247771711a32eb608cceed21834ef488ab4b69bb0f408b098fdfb61630819e3d1a1e57d5af67800ee74 0036-configure-fix-detection-of-atomic-builtins-in-libato.patch