• Arnd Bergmann's avatar
    kcsan: select CONFIG_CONSTRUCTORS · 6ba912f1
    Arnd Bergmann authored
    Building a kcsan enabled kernel for x86_64 with gcc-11 results in a lot
    of build warnings or errors without CONFIG_CONSTRUCTORS:
    
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/copy_mc.o'
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/cpu.o'
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/csum-partial_64.o'
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/csum-wrappers_64.o'
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/insn-eval.o'
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/insn.o'
    x86_64-linux-ld: error: unplaced orphan section `.ctors.65436' from `arch/x86/lib/misc.o'
    
    The same thing has been reported for mips64. I can't reproduce it for
    any other compiler version, so I don't know if constructors are always
    required here or if this is a gcc-11 specific implementation detail.
    
    I see no harm in always enabling constructors here, and this reliably
    fixes the build warnings for me.
    
    Link: https://lore.kernel.org/lkml/202204181801.r3MMkwJv-lkp@intel.com/T/
    Cc: Kees Cook <keescook@chromium.org>
    See-also: 3e663148 ("vmlinux.lds.h: Keep .ctors.* with .ctors")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarMarco Elver <elver@google.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    6ba912f1
Kconfig.kcsan 10 KB