]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
um: Enable CONFIG_CONSTRUCTORS
authorJohannes Berg <johannes.berg@intel.com>
Fri, 23 Aug 2019 13:36:50 +0000 (15:36 +0200)
committerRichard Weinberger <richard@nod.at>
Sun, 15 Sep 2019 19:37:13 +0000 (21:37 +0200)
We do need to call the constructors for *modules*, and
at least for KASAN in the future, we must call even the
kernel constructors only later when the kernel has been
initialized.

Instead of relying on libc to call them, emit an empty
section for libc and let the kernel's CONSTRUCTORS code
do the rest of the job.

Tested that it indeed doesn't work in modules, and does
work after the fixes in both, with a few functions with
__attribute__((constructor)) in both dynamic and static
builds.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/include/asm/common.lds.S
arch/um/kernel/dyn.lds.S
init/Kconfig
kernel/gcov/Kconfig

index 4049f2c463876205ccd9ff965e03fa111df6489e..d7086b985f27882cbe7b60defc0b7eff168e9f45 100644 (file)
@@ -83,8 +83,8 @@
        __preinit_array_end = .;
   }
   .init_array : {
+        /* dummy - we call this ourselves */
        __init_array_start = .;
-       *(.init_array)
        __init_array_end = .;
   }
   .fini_array : {
index f5001481010c0a5cb80a60b1d8ab5ad0e9c4ce5d..c69d69ee96bebae0c8125dbd2cd9b468398e2710 100644 (file)
@@ -103,7 +103,6 @@ SECTIONS
      be empty, which isn't pretty.  */
   . = ALIGN(32 / 8);
   .preinit_array     : { *(.preinit_array) }
-  .init_array     : { *(.init_array) }
   .fini_array     : { *(.fini_array) }
   .data           : {
     INIT_TASK_DATA(KERNEL_STACK_SIZE)
index bd7d650d4a996c7c10d2349a340f52c1f99c1e49..81293d78a6ad7d34f1c9b010ebf7480a63980757 100644 (file)
@@ -48,7 +48,6 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
 
 config CONSTRUCTORS
        bool
-       depends on !UML
 
 config IRQ_WORK
        bool
index 3941a9c48f833b3c9de3ee594a9ff5051d69fc5b..060e8e726755f02ddd18572f6e1279678d184510 100644 (file)
@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling"
 config GCOV_KERNEL
        bool "Enable gcov-based kernel profiling"
        depends on DEBUG_FS
-       select CONSTRUCTORS if !UML
+       select CONSTRUCTORS
        default n
        ---help---
        This option enables gcov-based code profiling (e.g. for code coverage