summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-12-02 02:45:10 -0500
committerRich Felker <dalias@aerifal.cx>2013-12-02 02:45:10 -0500
commita4b51633cfdecf597c247afe028c08b520816590 (patch)
tree40c6fbfdcef0ec4e637ff452484803fb9ff9f5e5 /arch/powerpc
parenta4e10e304d54c6ac3c12db08774ef74a978a2073 (diff)
downloadmusl-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.h7
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));
}