diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-01-16 23:23:31 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-01-16 23:23:31 +0000 |
commit | 0f59f5c12003e547e7557cc09da39c2abd63403d (patch) | |
tree | 6f0b23e0fef3a29053254871f5eb212e6e6397bb | |
parent | 20780a006fd26d5d6e97d81de479a7813f7ce05f (diff) | |
download | gcc-0f59f5c12003e547e7557cc09da39c2abd63403d.zip gcc-0f59f5c12003e547e7557cc09da39c2abd63403d.tar.gz gcc-0f59f5c12003e547e7557cc09da39c2abd63403d.tar.bz2 |
runtime: Add __sparc__ case for SETCONTEXT_CLOBBERS_TLS.
The glibc setcontext incorrectly modifies %g7 on SPARC.
From Richard Henderson.
From-SVN: r219778
-rw-r--r-- | libgo/runtime/proc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index c4f27fb..da0f2ed 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 |