Re: [PATCH 0/8] linker-section array fix and clean ups

From: Johan Hovold
Date: Fri Nov 13 2020 - 09:18:34 EST


On Wed, Nov 11, 2020 at 04:47:16PM +0100, Jessica Yu wrote:

> Thanks for providing the links and references. Your explanation and
> this reply from Jakub [1] clarified things for me. I was not aware of
> the distinction gcc made between aligned attributes on types vs. on
> variables. So from what I understand now, gcc suppresses the
> optimization when the alignment is specified in the variable
> declaration, but not necessarily when the aligned attribute is just on
> the type.
>
> Even though it's been in use for a long time, I think it would be
> really helpful if this gcc quirk was explained just a bit more in the
> patch changelogs, especially since this is undocumented behavior.
> I found the explanation in [1] (as well as in your cover letter) to be
> sufficient. Maybe something like "GCC suppresses any optimizations
> increasing alignment when the alignment is specified in the variable
> declaration, as opposed to just on the type definition. Therefore,
> explicitly specify type alignment when declaring entries to prevent
> gcc from increasing alignment."

Sure, I can try to expand the commit messages a bit.

> In any case, I can take the module and moduleparam.h patches through
> my tree, but I will wait a few days in case there are any objections.

Sounds good, thanks. I'll send a v2 next week then.

Johan

> [1] https://lore.kernel.org/lkml/20201021131806.GA2176@tucnak/