Skip to content

Commit 6ba912f

Browse files
arndbpaulmckrcu
authored andcommitted
kcsan: select CONFIG_CONSTRUCTORS
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: 3e66314 ("vmlinux.lds.h: Keep .ctors.* with .ctors") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 1b929c0 commit 6ba912f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/Kconfig.kcsan

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ menuconfig KCSAN
1414
bool "KCSAN: dynamic data race detector"
1515
depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER
1616
depends on DEBUG_KERNEL && !KASAN
17+
select CONSTRUCTORS
1718
select STACKTRACE
1819
help
1920
The Kernel Concurrency Sanitizer (KCSAN) is a dynamic

0 commit comments

Comments
 (0)