diff mbox series

[02/16] powerpc: override __ALIGN() and __ALIGN_STR() macros

Message ID 20220808114908.240813-3-sv@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series objtool: Enable and implement --mcount option on powerpc | expand

Commit Message

Sathvika Vasireddy Aug. 8, 2022, 11:48 a.m. UTC
Since we need an alignment of 4 bytes, override
__ALIGN() and __ALIGN_STR() accordingly.

Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
---
 arch/powerpc/include/asm/linkage.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Christophe Leroy Aug. 10, 2022, 8:31 a.m. UTC | #1
Le 08/08/2022 à 13:48, Sathvika Vasireddy a écrit :
> Since we need an alignment of 4 bytes, override
> __ALIGN() and __ALIGN_STR() accordingly.

Why/When do we now need an alignment of 4 bytes ? Please explain the 
reason in the commit message.

> 
> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
> ---
>   arch/powerpc/include/asm/linkage.h | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
> index b71b9582e754..8df88fe61438 100644
> --- a/arch/powerpc/include/asm/linkage.h
> +++ b/arch/powerpc/include/asm/linkage.h
> @@ -2,8 +2,12 @@
>   #ifndef _ASM_POWERPC_LINKAGE_H
>   #define _ASM_POWERPC_LINKAGE_H
>   
> +#include <linux/stringify.h>
>   #include <asm/types.h>
>   
> +#define __ALIGN			.align 2
> +#define __ALIGN_STR		__stringify(__ALIGN)

Why do you need to use __stringify ?

ARM64 does:

#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"		\
Sathvika Vasireddy Aug. 18, 2022, 10:46 a.m. UTC | #2
Hi Christophe,

On 10/08/22 14:01, Christophe Leroy wrote:
>
> Le 08/08/2022 à 13:48, Sathvika Vasireddy a écrit :
>> Since we need an alignment of 4 bytes, override
>> __ALIGN() and __ALIGN_STR() accordingly.
> Why/When do we now need an alignment of 4 bytes ? Please explain the
> reason in the commit message.
Powerpc instructions must be word-aligned. Currently, there is an 
alignment of 16 bytes (by default),
and it is much more than what is required for powerpc (4 bytes).

The default expansion of these macros are:
#define __ALIGN        .align 4,0x90
#define __ALIGN_STR    ".align 4,0x90"

Since Powerpc Linux does not require a 16 byte alignment, override 
_ALIGN() and __ALIGN_STR() macros
to use required 4 byte alignment.

Sure, I'll explain the reason in commit message.
>
>> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
>> ---
>>    arch/powerpc/include/asm/linkage.h | 4 ++++
>>    1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
>> index b71b9582e754..8df88fe61438 100644
>> --- a/arch/powerpc/include/asm/linkage.h
>> +++ b/arch/powerpc/include/asm/linkage.h
>> @@ -2,8 +2,12 @@
>>    #ifndef _ASM_POWERPC_LINKAGE_H
>>    #define _ASM_POWERPC_LINKAGE_H
>>    
>> +#include <linux/stringify.h>
>>    #include <asm/types.h>
>>    
>> +#define __ALIGN			.align 2
>> +#define __ALIGN_STR		__stringify(__ALIGN)
> Why do you need to use __stringify ?
>
> ARM64 does:
>
> #define __ALIGN		.align 2
> #define __ALIGN_STR	".align 2"
We could use either __stringify() or quotes, both do the same thing.
While arm64 does ".align 2",

x86 does:
#define __ALIGN         .p2align 4, 0x90
#define __ALIGN_STR     __stringify(__ALIGN)
>
>
>
>
>> +
>>    #ifdef CONFIG_PPC64_ELF_ABI_V1
>>    #define cond_syscall(x) \
>>    	asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"		\

Thanks for reviewing!

- Sathvika
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
index b71b9582e754..8df88fe61438 100644
--- a/arch/powerpc/include/asm/linkage.h
+++ b/arch/powerpc/include/asm/linkage.h
@@ -2,8 +2,12 @@ 
 #ifndef _ASM_POWERPC_LINKAGE_H
 #define _ASM_POWERPC_LINKAGE_H
 
+#include <linux/stringify.h>
 #include <asm/types.h>
 
+#define __ALIGN			.align 2
+#define __ALIGN_STR		__stringify(__ALIGN)
+
 #ifdef CONFIG_PPC64_ELF_ABI_V1
 #define cond_syscall(x) \
 	asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"		\