Skip to content

Commit 786b238

Browse files
jmberg-intelrichardweinberger
authored andcommitted
um: Enable CONFIG_CONSTRUCTORS
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>
1 parent 324f80c commit 786b238

4 files changed

Lines changed: 2 additions & 4 deletions

File tree

‎arch/um/include/asm/common.lds.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
__preinit_array_end = .;
8484
}
8585
.init_array : {
86+
/* dummy - we call this ourselves */
8687
__init_array_start = .;
87-
*(.init_array)
8888
__init_array_end = .;
8989
}
9090
.fini_array : {

‎arch/um/kernel/dyn.lds.S‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ SECTIONS
103103
be empty, which isn't pretty. */
104104
. = ALIGN(32 / 8);
105105
.preinit_array : { *(.preinit_array) }
106-
.init_array : { *(.init_array) }
107106
.fini_array : { *(.fini_array) }
108107
.data : {
109108
INIT_TASK_DATA(KERNEL_STACK_SIZE)

‎init/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
4848

4949
config CONSTRUCTORS
5050
bool
51-
depends on !UML
5251

5352
config IRQ_WORK
5453
bool

‎kernel/gcov/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling"
44
config GCOV_KERNEL
55
bool "Enable gcov-based kernel profiling"
66
depends on DEBUG_FS
7-
select CONSTRUCTORS if !UML
7+
select CONSTRUCTORS
88
default n
99
---help---
1010
This option enables gcov-based code profiling (e.g. for code coverage

0 commit comments

Comments
 (0)