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

From: Steven Rostedt
Date: Fri Nov 06 2020 - 11:55:29 EST


On Fri, 6 Nov 2020 17:45:37 +0100
Johan Hovold <johan@xxxxxxxxxx> wrote:

> It's simply specifying alignment when declaring the variable that
> prevents this optimisation. The relevant code is in the function
> align_variable() in [1] where DATA_ALIGNMENT() is never called in case
> an alignment has been specified (!DECL_USER_ALIGN(decl)).
>
> There's no mention in the documentation of this that I'm aware of, but
> this is the way the aligned attribute has worked since its introduction
> judging from the commit history.
>
> As mentioned above, we've been relying on this for kernel parameters and
> other structures since 2003-2004 so if it ever were to change we'd find
> out soon enough.
>
> It's about to be used for scheduler classes as well. [2]

Is this something that gcc folks are aware of? Yes, we appear to be relying
on undocumented implementations, but that hasn't caused gcc to break the
kernel in the past.

-- Steve