Thread (10 messages) 10 messages, 2 authors, 2021-03-18
STALE2019d

[PATCH 6/6] um: fix CONFIG_GCOV for modules

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2021-03-12 09:56:34
Also in: linux-fsdevel, lkml
Subsystem: the rest, user-mode linux (uml) · Maintainers: Linus Torvalds, Richard Weinberger, Anton Ivanov, Johannes Berg

From: Johannes Berg <redacted>

At least with current toolchain versions, gcov (as enabled
by CONFIG_GCOV) requires init and exit handlers to run. For
modules, this wasn't done properly, so use the new support
for CONFIG_MODULE_DESTRUCTORS as well as CONFIG_CONSTRUCTORS
to have gcov init and exit called appropriately.

Signed-off-by: Johannes Berg <redacted>
---
 arch/um/Kconfig.debug    | 2 ++
 arch/um/kernel/process.c | 2 ++
 2 files changed, 4 insertions(+)
diff --git a/arch/um/Kconfig.debug b/arch/um/Kconfig.debug
index ca040b4e86e5..74b27b11cb44 100644
--- a/arch/um/Kconfig.debug
+++ b/arch/um/Kconfig.debug
@@ -17,6 +17,8 @@ config GCOV_BASE
 	bool "Enable gcov support (selectively)"
 	depends on DEBUG_INFO
 	depends on !KCOV && !GCOV_KERNEL
+	select CONSTRUCTORS
+	select WANT_MODULE_DESTRUCTORS
 	help
 	  This option allows developers to retrieve coverage data from a UML
 	  session, stored to disk just like with a regular userspace binary,
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index c5011064b5dd..33f895a95ff8 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -240,6 +240,8 @@ void do_uml_exitcalls(void)
 	call = &__uml_exitcall_end;
 	while (--call >= &__uml_exitcall_begin)
 		(*call)();
+
+	run_all_module_destructors();
 }
 
 char *uml_strdup(const char *string)
-- 
2.29.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help