]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
module: simplify version-attribute handling
authorJohan Hovold <johan@kernel.org>
Mon, 23 Nov 2020 10:23:15 +0000 (11:23 +0100)
committerJessica Yu <jeyu@kernel.org>
Wed, 25 Nov 2020 14:44:46 +0000 (15:44 +0100)
commitb112082c8930e7aa72422484b2d31d3aa06f58bc
tree3de6d98d856660365e4be2e1d3f47de9216aaecd
parent0801a0073f86e020987acbbd96b50f9c85d79de8
module: simplify version-attribute handling

Instead of using the array-of-pointers trick to avoid having gcc mess up
the built-in module-version array stride, specify type alignment when
declaring entries to prevent gcc from increasing alignment.

This is essentially an alternative (one-line) fix to the problem
addressed by commit b4bc842802db ("module: deal with alignment issues in
built-in module versions").

gcc can increase the alignment of larger objects with static extent as
an optimisation, but this can be suppressed by using the aligned
attribute when declaring variables.

Note that we have been relying on this behaviour for kernel parameters
for 16 years and it indeed hasn't changed since the introduction of the
aligned attribute in gcc-3.1.

Link: https://lore.kernel.org/lkml/20201103175711.10731-1-johan@kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
include/linux/module.h
kernel/params.c