# HG changeset patch
# Parent bdc02d4914d89c66f92b2c0bd67547817cdfc646
Detect Solaris 8/9 SPARC makecontext
@@ -182,6 +182,9 @@
*/
#undef LT_OBJDIR
+/* Define if makecontext expects top of stack in uc_stack. */
+#undef MAKECONTEXT_STACK_TOP
+
/* Name of package */
#undef PACKAGE
@@ -14871,6 +14871,20 @@ if test "$libgo_has_struct_exception" =
fi
+case "$target" in
+ sparc*-*-solaris2.[89]*)
+ libgo_cv_lib_makecontext_stack_top=yes
+ ;;
+ *)
+ libgo_cv_lib_makecontext_stack_top=no
+ ;;
+esac
+if test "$libgo_cv_lib_makecontext_stack_top" = "yes"; then
+
+$as_echo "#define MAKECONTEXT_STACK_TOP 1" >>confdefs.h
+
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setcontext clobbers TLS variables" >&5
$as_echo_n "checking whether setcontext clobbers TLS variables... " >&6; }
if test "${libgo_cv_lib_setcontext_clobbers_tls+set}" = set; then :
@@ -14972,6 +14986,9 @@ main ()
abort ();
c.uc_stack.ss_sp = stack;
+#ifdef MAKECONTEXT_STACK_TOP
+ c.uc_stack.ss_sp += sizeof stack;
+#endif
c.uc_stack.ss_flags = 0;
c.uc_stack.ss_size = sizeof stack;
c.uc_link = NULL;
@@ -609,6 +609,21 @@ if test "$libgo_has_struct_exception" =
[Define to 1 if <math.h> defines struct exception])
fi
+dnl Check if makecontext expects the uc_stack member of ucontext to point
+dnl to the top of the stack.
+case "$target" in
+ sparc*-*-solaris2.[[89]]*)
+ libgo_cv_lib_makecontext_stack_top=yes
+ ;;
+ *)
+ libgo_cv_lib_makecontext_stack_top=no
+ ;;
+esac
+if test "$libgo_cv_lib_makecontext_stack_top" = "yes"; then
+ AC_DEFINE(MAKECONTEXT_STACK_TOP, 1,
+ [Define if makecontext expects top of stack in uc_stack.])
+fi
+
dnl See whether setcontext changes the value of TLS variables.
AC_CACHE_CHECK([whether setcontext clobbers TLS variables],
[libgo_cv_lib_setcontext_clobbers_tls],
@@ -665,6 +680,9 @@ main ()
abort ();
c.uc_stack.ss_sp = stack;
+#ifdef MAKECONTEXT_STACK_TOP
+ c.uc_stack.ss_sp += sizeof stack;
+#endif
c.uc_stack.ss_flags = 0;
c.uc_stack.ss_size = sizeof stack;
c.uc_link = NULL;
@@ -1297,6 +1297,9 @@ __go_go(void (*fn)(void*), void* arg)
getcontext(&newg->context);
newg->context.uc_stack.ss_sp = sp;
+#ifdef MAKECONTEXT_STACK_TOP
+ newg->context.uc_stack.ss_sp += spsize;
+#endif
newg->context.uc_stack.ss_size = spsize;
makecontext(&newg->context, kickoff, 0);