workaround clang deficiency affecting thread pointer access on powerpc

based on patch by Richard Pennington, who initially reported the
issue.
This commit is contained in:
Rich Felker 2013-12-02 02:45:10 -05:00
parent a4e10e304d
commit a4b51633cf
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,11 @@
static inline struct pthread *__pthread_self()
{
#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));
}