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

Michael Ellerman mpe at ellerman.id.au
Wed Aug 31 17:22:25 AEST 2022


"Nicholas Piggin" <npiggin at gmail.com> writes:
> On Mon Aug 29, 2022 at 3:52 PM AEST, Sathvika Vasireddy wrote:
>> 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 __ALIGN() macro is:
>> #define __ALIGN       .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.
>
> Alignment can be desirable beyond the minimum requirement, for
> example 16 byte alignment for functions could be helpful for
> instruction fetch. So it should be explained why possible
> benefits of the larger alignment are not worth it.

Using ".align 2" matches what our existing _GLOBAL macro does. So this
change basically just propagates that existing alignment into this new
macro, which is used for similar purposes.

So if we want to increase the alignment we should do that explicitly,
and update _GLOBAL at the same time.

The change log should probably just say ~= "use the same alignment as
the existing _GLOBAL macro".

What's more important, but not mentioned in the change log, is that we
don't want to pad with 0x90, because repeated 0x90s are not a nop or
trap on powerpc.

cheers


More information about the Linuxppc-dev mailing list