• J
    module: simplify version-attribute handling · b112082c
    Johan Hovold 提交于
    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 b4bc8428 ("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.orgSigned-off-by: NJohan Hovold <johan@kernel.org>
    Signed-off-by: NJessica Yu <jeyu@kernel.org>
    b112082c
module.h 23.9 KB