[RFC PATCH 2/7] powerpc/64: abstract asm global variable declaration and access

Christophe Leroy christophe.leroy at csgroup.eu
Thu Sep 22 02:51:33 AEST 2022



Le 19/09/2022 à 16:01, Nicholas Piggin a écrit :
> Use asm helpers to access global variables and to define them in asm.
> Stop using got addressing and use the more common @toc offsets. 32-bit
> already does this so that should be unchanged.
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---

> diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot/ppc_asm.h
> index 192b97523b05..ea290bf78fb2 100644
> --- a/arch/powerpc/boot/ppc_asm.h
> +++ b/arch/powerpc/boot/ppc_asm.h
> @@ -84,4 +84,8 @@
>   #define MFTBU(dest)			mfspr dest, SPRN_TBRU
>   #endif
>   
> +#define LOAD_REG_ADDR(reg,name)			\
> +	addis	reg,r2,name at toc@ha;		\
> +	addi	reg,reg,name at toc@l
> +
>   #endif /* _PPC64_PPC_ASM_H */

Wouldn't it be better as a GAS macro ?


More information about the Linuxppc-dev mailing list