2022-10-02 11:15:06

by Sathvika Vasireddy

[permalink] [raw]
Subject: [PATCH v4 02/16] powerpc: Override __ALIGN and __ALIGN_STR macros

In a subsequent patch, we would want to annotate powerpc assembly functions
with SYM_FUNC_START_LOCAL macro. This macro depends on __ALIGN macro.

The default expansion of __ALIGN macro is:
#define __ALIGN .align 4,0x90

So, override __ALIGN and __ALIGN_STR macros to use the same alignment as
that of the existing _GLOBAL macro. Also, do not pad with 0x90, because
repeated 0x90s are not a nop or trap on powerpc.

Signed-off-by: Sathvika Vasireddy <[email protected]>
---
arch/powerpc/include/asm/linkage.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
index b71b9582e754..b88d1d2cf304 100644
--- a/arch/powerpc/include/asm/linkage.h
+++ b/arch/powerpc/include/asm/linkage.h
@@ -4,6 +4,9 @@

#include <asm/types.h>

+#define __ALIGN .align 2
+#define __ALIGN_STR ".align 2"
+
#ifdef CONFIG_PPC64_ELF_ABI_V1
#define cond_syscall(x) \
asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \
--
2.31.1


2022-10-02 17:55:51

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v4 02/16] powerpc: Override __ALIGN and __ALIGN_STR macros



Le 02/10/2022 à 12:42, Sathvika Vasireddy a écrit :
> In a subsequent patch, we would want to annotate powerpc assembly functions
> with SYM_FUNC_START_LOCAL macro. This macro depends on __ALIGN macro.
>
> The default expansion of __ALIGN macro is:
> #define __ALIGN .align 4,0x90
>
> So, override __ALIGN and __ALIGN_STR macros to use the same alignment as
> that of the existing _GLOBAL macro. Also, do not pad with 0x90, because
> repeated 0x90s are not a nop or trap on powerpc.
>
> Signed-off-by: Sathvika Vasireddy <[email protected]>

Reviewed-by: Christophe Leroy <[email protected]>

> ---
> arch/powerpc/include/asm/linkage.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
> index b71b9582e754..b88d1d2cf304 100644
> --- a/arch/powerpc/include/asm/linkage.h
> +++ b/arch/powerpc/include/asm/linkage.h
> @@ -4,6 +4,9 @@
>
> #include <asm/types.h>
>
> +#define __ALIGN .align 2
> +#define __ALIGN_STR ".align 2"
> +
> #ifdef CONFIG_PPC64_ELF_ABI_V1
> #define cond_syscall(x) \
> asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \