15 Jan, 2021

1 commit

  • On modules with no executable code, LLVM generates a __cfi_check stub,
    but won't align it to page size as expected. This change ensures the
    function is at the beginning of the .text section and correctly aligned
    for the CFI shadow.

    Also discard the .eh_frame section, which LLD may emit with CFI_CLANG.

    Bug: 145210207
    Change-Id: I08923febb549aa64454282cc864ac80dadd717b9
    Link: https://bugs.llvm.org/show_bug.cgi?id=46293
    Signed-off-by: Sami Tolvanen

    Sami Tolvanen
     

17 Dec, 2020

1 commit

  • LLD always splits sections with LTO, which increases module sizes. This
    change adds linker script rules to merge the split sections in the final
    module.

    Bug: 145210207
    Change-Id: Id0b964e732b5c72177d8f6dc0f75114551445b97
    Link: https://lore.kernel.org/lkml/20201211184633.3213045-6-samitolvanen@google.com/
    Suggested-by: Nick Desaulniers
    Signed-off-by: Sami Tolvanen
    Reviewed-by: Kees Cook

    Sami Tolvanen
     

24 Sep, 2020

1 commit

  • There was a request to preprocess the module linker script like we
    do for the vmlinux one. (https://lkml.org/lkml/2020/8/21/512)

    The difference between vmlinux.lds and module.lds is that the latter
    is needed for external module builds, thus must be cleaned up by
    'make mrproper' instead of 'make clean'. Also, it must be created
    by 'make modules_prepare'.

    You cannot put it in arch/$(SRCARCH)/kernel/, which is cleaned up by
    'make clean'. I moved arch/$(SRCARCH)/kernel/module.lds to
    arch/$(SRCARCH)/include/asm/module.lds.h, which is included from
    scripts/module.lds.S.

    scripts/module.lds is fine because 'make clean' keeps all the
    build artifacts under scripts/.

    You can add arch-specific sections in .

    Signed-off-by: Masahiro Yamada
    Tested-by: Jessica Yu
    Acked-by: Will Deacon
    Acked-by: Geert Uytterhoeven
    Acked-by: Palmer Dabbelt
    Reviewed-by: Kees Cook
    Acked-by: Jessica Yu

    Masahiro Yamada