[PATCH 6/6] um: fix CONFIG_GCOV for modules
Johannes Berg
johannes at sipsolutions.net
Fri Mar 12 09:55:26 GMT 2021
From: Johannes Berg <johannes.berg at intel.com>
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 <johannes.berg at intel.com>
---
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
More information about the linux-um
mailing list