diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-12-15 16:06:25 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-12-15 16:06:25 +0100 |
commit | cb976fba4c51ede7bf8cee5035888527c308dfbc (patch) | |
tree | 3bc0e586664cc7cf2a6c70d7b8df594cc7600515 /sysdeps/powerpc/nptl | |
parent | a6d2f948b71adcb5ea395cb04833bc645eab45e6 (diff) | |
download | glibc-cb976fba4c51ede7bf8cee5035888527c308dfbc.zip glibc-cb976fba4c51ede7bf8cee5035888527c308dfbc.tar.gz glibc-cb976fba4c51ede7bf8cee5035888527c308dfbc.tar.bz2 |
powerpc: Use global register variable in <thread_pointer.h>
A local register variable is merely a compiler hint, and so not
appropriate in this context. Move the global register variable into
<thread_pointer.h> and include it from <tls.h>, as there can only
be one global definition for one particular register.
Fixes commit 8dbeb0561eeb876f557ac9eef5721912ec074ea5
("nptl: Add <thread_pointer.h> for defining __thread_pointer").
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/nptl')
-rw-r--r-- | sysdeps/powerpc/nptl/thread_pointer.h | 13 | ||||
-rw-r--r-- | sysdeps/powerpc/nptl/tls.h | 7 |
2 files changed, 8 insertions, 12 deletions
diff --git a/sysdeps/powerpc/nptl/thread_pointer.h b/sysdeps/powerpc/nptl/thread_pointer.h index 8fd5ba6..4feba59 100644 --- a/sysdeps/powerpc/nptl/thread_pointer.h +++ b/sysdeps/powerpc/nptl/thread_pointer.h @@ -19,15 +19,16 @@ #ifndef _SYS_THREAD_POINTER_H #define _SYS_THREAD_POINTER_H -static inline void * -__thread_pointer (void) -{ #ifdef __powerpc64__ - register void *__result asm ("r13"); +register void *__thread_register asm ("r13"); #else - register void *__result asm ("r2"); +register void *__thread_register asm ("r2"); #endif - return __result; + +static inline void * +__thread_pointer (void) +{ + return __thread_register; } #endif /* _SYS_THREAD_POINTER_H */ diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h index 63098f4..d03fcb6 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -26,6 +26,7 @@ # include <stddef.h> # include <stdint.h> # include <dl-dtv.h> +# include <thread_pointer.h> #else /* __ASSEMBLER__ */ # include <tcb-offsets.h> @@ -36,16 +37,10 @@ #ifndef __powerpc64__ /* Register r2 (tp) is reserved by the ABI as "thread pointer". */ # define PT_THREAD_POINTER PT_R2 -# ifndef __ASSEMBLER__ -register void *__thread_register __asm__ ("r2"); -# endif #else /* __powerpc64__ */ /* Register r13 (tp) is reserved by the ABI as "thread pointer". */ # define PT_THREAD_POINTER PT_R13 -# ifndef __ASSEMBLER__ -register void *__thread_register __asm__ ("r13"); -# endif #endif /* __powerpc64__ */ #ifndef __ASSEMBLER__ |