]> Git Repo - linux.git/commit
vmlinux.lds.h: Handle clang's module.{c,d}tor sections
authorNathan Chancellor <[email protected]>
Sat, 31 Jul 2021 02:31:08 +0000 (19:31 -0700)
committerKees Cook <[email protected]>
Wed, 11 Aug 2021 19:19:58 +0000 (12:19 -0700)
commit848378812e40152abe9b9baf58ce2004f76fb988
treef3c42eae9849cfbe6e39cadf9d5fffe30df6e785
parent36a21d51725af2ce0700c6ebcb6b9594aac658a6
vmlinux.lds.h: Handle clang's module.{c,d}tor sections

A recent change in LLVM causes module_{c,d}tor sections to appear when
CONFIG_K{A,C}SAN are enabled, which results in orphan section warnings
because these are not handled anywhere:

ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.asan.module_ctor) is being placed in '.text.asan.module_ctor'
ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.asan.module_dtor) is being placed in '.text.asan.module_dtor'
ld.lld: warning: arch/x86/pci/built-in.a(legacy.o):(.text.tsan.module_ctor) is being placed in '.text.tsan.module_ctor'

Fangrui explains: "the function asan.module_ctor has the SHF_GNU_RETAIN
flag, so it is in a separate section even with -fno-function-sections
(default)".

Place them in the TEXT_TEXT section so that these technologies continue
to work with the newer compiler versions. All of the KASAN and KCSAN
KUnit tests continue to pass after this change.

Cc: [email protected]
Link: https://github.com/ClangBuiltLinux/linux/issues/1432
Link: https://github.com/llvm/llvm-project/commit/7b789562244ee941b7bf2cefeb3fc08a59a01865
Signed-off-by: Nathan Chancellor <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Reviewed-by: Fangrui Song <[email protected]>
Acked-by: Marco Elver <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
include/asm-generic/vmlinux.lds.h
This page took 0.054563 seconds and 4 git commands to generate.