[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210312104627.54210a33e4c0.I9807ad0ea6ee21a81f86d367f3b61e5f24f8b30b@changeid>
Date: Fri, 12 Mar 2021 10:55:26 +0100
From: Johannes Berg <johannes@...solutions.net>
To: linux-kernel@...r.kernel.org, linux-um@...ts.infradead.org
Cc: Jessica Yu <jeyu@...nel.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org,
Johannes Berg <johannes.berg@...el.com>
Subject: [PATCH 6/6] um: fix CONFIG_GCOV for modules
From: Johannes Berg <johannes.berg@...el.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@...el.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
Powered by blists - more mailing lists