From cb976fba4c51ede7bf8cee5035888527c308dfbc Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 15 Dec 2021 16:06:25 +0100 Subject: [PATCH] powerpc: Use global register variable in A local register variable is merely a compiler hint, and so not appropriate in this context. Move the global register variable into and include it from , as there can only be one global definition for one particular register. Fixes commit 8dbeb0561eeb876f557ac9eef5721912ec074ea5 ("nptl: Add for defining __thread_pointer"). Reported-by: Mathieu Desnoyers Reviewed-by: Raphael M Zinsly --- sysdeps/powerpc/nptl/thread_pointer.h | 13 +++++++------ 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 8fd5ba671f..4feba59610 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 63098f4048..d03fcb6983 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -26,6 +26,7 @@ # include # include # include +# include #else /* __ASSEMBLER__ */ # include @@ -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__ -- 2.11.4.GIT