Skip to content

Commit

Permalink
um: Enable CONFIG_CONSTRUCTORS
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
jmberg-intel authored and richardweinberger committed Sep 15, 2019
1 parent 324f80c commit 786b238
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arch/um/include/asm/common.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
__preinit_array_end = .;
}
.init_array : {
/* dummy - we call this ourselves */
__init_array_start = .;
*(.init_array)
__init_array_end = .;
}
.fini_array : {
Expand Down
1 change: 0 additions & 1 deletion arch/um/kernel/dyn.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED

config CONSTRUCTORS
bool
depends on !UML

config IRQ_WORK
bool
Expand Down
2 changes: 1 addition & 1 deletion kernel/gcov/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 786b238

Please sign in to comment.