summaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-16 23:23:31 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-16 23:23:31 +0000
commitac60574696f055836ae7e111fb4627e4d4ea04da (patch)
tree6f0b23e0fef3a29053254871f5eb212e6e6397bb /libgo/runtime
parent3325375ed5c26fce1cdf9a772546c67b4a7d57d7 (diff)
downloadgcc-ac60574696f055836ae7e111fb4627e4d4ea04da.tar.gz
runtime: Add __sparc__ case for SETCONTEXT_CLOBBERS_TLS.
The glibc setcontext incorrectly modifies %g7 on SPARC. From Richard Henderson. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/proc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index c4f27fb6bbb..da0f2ed3a75 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -126,6 +126,30 @@ fixcontext(ucontext_t* c)
c->uc_mcontext._mc_tlsbase = tlsbase;
}
+# elif defined(__sparc__)
+
+static inline void
+initcontext(void)
+{
+}
+
+static inline void
+fixcontext(ucontext_t *c)
+{
+ /* ??? Using
+ register unsigned long thread __asm__("%g7");
+ c->uc_mcontext.gregs[REG_G7] = thread;
+ results in
+ error: variable ‘thread’ might be clobbered by \
+ ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
+ which ought to be false, as %g7 is a fixed register. */
+
+ if (sizeof (c->uc_mcontext.gregs[REG_G7]) == 8)
+ asm ("stx %%g7, %0" : "=m"(c->uc_mcontext.gregs[REG_G7]));
+ else
+ asm ("st %%g7, %0" : "=m"(c->uc_mcontext.gregs[REG_G7]));
+}
+
# else
# error unknown case for SETCONTEXT_CLOBBERS_TLS