diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-12-02 02:45:10 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-12-02 02:45:10 -0500 |
commit | a4b51633cfdecf597c247afe028c08b520816590 (patch) | |
tree | 40c6fbfdcef0ec4e637ff452484803fb9ff9f5e5 /arch/powerpc | |
parent | a4e10e304d54c6ac3c12db08774ef74a978a2073 (diff) | |
download | musl-a4b51633cfdecf597c247afe028c08b520816590.tar.gz |
workaround clang deficiency affecting thread pointer access on powerpc
based on patch by Richard Pennington, who initially reported the
issue.
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/pthread_arch.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/pthread_arch.h b/arch/powerpc/pthread_arch.h index cb2a70b8..2d1ee43c 100644 --- a/arch/powerpc/pthread_arch.h +++ b/arch/powerpc/pthread_arch.h @@ -1,6 +1,11 @@ static inline struct pthread *__pthread_self() { - register char* tp __asm__("r2"); +#ifdef __clang__ + char *tp; + __asm__ __volatile__ ("mr %0, 2" : "=r"(tp) : : ); +#else + register char *tp __asm__("r2"); +#endif return (pthread_t)(tp - 0x7000 - sizeof(struct pthread)); } |