Re: [PATCH] ftrace: Allow section alignment

From: Matt Fleming
Date: Fri Nov 07 2008 - 08:59:54 EST


2008/11/7 Steven Rostedt <rostedt@xxxxxxxxxxx>:
>
> On Fri, 7 Nov 2008, Peter Zijlstra wrote:
>
>> On Fri, 2008-11-07 at 13:12 +0000, Matt Fleming wrote:
>> > Provide a means of aligning the __mcount_loc section.
>>
>> Not that I object to the patch, but this changelog needs work.
>>
>> Its wrong, it doesn't provide means, it plain does.
>> It doesn't tell us why.
>
> Also, please tell us what broke. Did you have a compiler that did
> not align it properly? As long as the alignment is less than or equal to
> the word size, it is fine. If the alignment is larger than the word size,
> then there will be holes in the mcount_loc section and that will break
> ftrace. Heck, an alignment of 1 should work for everyone ;-) All the
> sections are packed together in an aligned space when it is pulled in by
> the linker. If that is not true, then the linker script needs to be fixed.
>

I've tried to explain the bug better in the attached patch. The issue
is not that there were gaps in __mcount_loc, rather that the addresses
in __mcount_loc were not aligned on a 4-byte boundary by the
assembler. Unaligned accesses are not supported by our architecture
and an alignment of 1-byte will likely lead to performance loss on
architectures that do support them.