gcov: fix when CONFIG_MODULES is not set
Subsystems (2)
PATCH v3 1/1 gcov: fix when CONFIG_MODULES is not set
From: Tri Vo <[email protected]>
--- kernel/gcov/clang.c | 4 ++++ kernel/gcov/gcc_3_4.c | 4 ++++ kernel/gcov/gcc_4_7.c | 4 ++++ 3 files changed, 12 insertions(+)
kernel/gcov/clang.c +4 -0
@@ -223,7 +223,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)*/ bool gcov_info_within_module (struct gcov_info *info,struct module *mod) { +#ifdef CONFIG_MODULES return within_module ((unsigned long )info->filename, mod); +#else +return false; +#endif }/* Symbolic links to be created for each profiling data file. */
kernel/gcov/gcc_3_4.c +4 -0
@@ -146,7 +146,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)*/ bool gcov_info_within_module (struct gcov_info *info,struct module *mod) { +#ifdef CONFIG_MODULES return within_module ((unsigned long )info, mod); +#else +return false; +#endif }/* Symbolic links to be created for each profiling data file. */
kernel/gcov/gcc_4_7.c +4 -0
@@ -159,7 +159,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)*/ bool gcov_info_within_module (struct gcov_info *info,struct module *mod) { +#ifdef CONFIG_MODULES return within_module ((unsigned long )info, mod); +#else +return false; +#endif }/* Symbolic links to be created for each profiling data file. */
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Quoted 4 lines · On 4/1/19 8:09 PM, [email protected] wrote:
From: Tri Vo <[email protected]>
Fixes 8c3d220cb6b5 ("gcov: clang support")
Quoted 9 lines
Cc Greg Hackmann <[email protected]>Cc Peter Oberparleiter <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>Signed-off-by Tri Vo <[email protected]>
Thanks.
Quoted 55 lines
--- kernel/gcov/clang.c | 4 ++++ kernel/gcov/gcc_3_4.c | 4 ++++ kernel/gcov/gcc_4_7.c | 4 ++++ 3 files changed, 12 insertions(+)kernel/gcov/clang.c +4
-0@@ -223,7 +223,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)*/ bool gcov_info_within_module (struct gcov_info *info,struct module *mod) { +#ifdef CONFIG_MODULES return within_module ((unsigned long )info->filename, mod); +#else +return false; +#endif }/* Symbolic links to be created for each profiling data file. */ kernel/gcov/gcc_3_4.c +4
-0@@ -146,7 +146,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)*/ bool gcov_info_within_module (struct gcov_info *info,struct module *mod) { +#ifdef CONFIG_MODULES return within_module ((unsigned long )info, mod); +#else +return false; +#endif }/* Symbolic links to be created for each profiling data file. */ kernel/gcov/gcc_4_7.c +4
-0@@ -159,7 +159,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)*/ bool gcov_info_within_module (struct gcov_info *info,struct module *mod) { +#ifdef CONFIG_MODULES return within_module ((unsigned long )info, mod); +#else +return false; +#endif }/* Symbolic links to be created for each profiling data file. */
Signature · 1 line
~Randy
Quoted 3 lines · On Tue, Apr 02, 2019 at 10:09:56AM +0700, [email protected] wrote:
From: Tri Vo <[email protected]>
Fixes 8c3d220cb6b5 ("gcov: clang support")
I think this is the wrong fix. Why not simply:
+++ b/include/linux/module.h
@@ -709,6 +709,11 @@ static inline bool is_module_text_address(unsigned long addr)
return false;
}
+static inline bool within_module(unsigned long addr, const struct module *mod) +{
+ return false;
+}
+
/* Get/put a kernel symbol (calls should be symmetric) */
#define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) #define symbol_put(x) do { } while (0)
Quoted 7 lines · Matthew Wilcox
Quoted 3 lines · On Tue, Apr 02, 2019 at 10:09:56AM +0700, [email protected] wrote:
From: Tri Vo <[email protected]>
Fixes 8c3d220cb6b5 ("gcov: clang support")I think this is the wrong fix. Why not simply:
I spoke with Tri quickly about this proposal and we agree it's a better fix.
Andrew, would you mind dropping:
https://ozlabs.org/~akpm/mmotm/broken-out/gcov-clang-support-fix.patch
?
Matthew, would you please send that patch with a commit message? Or if you would prefer us to send with your suggested-by tag, we can do that, too. Whichever you prefer, please let me know. Thanks for the suggestion.
Quoted 15 lines
+++
b/include/linux/module.h(quoted diff) +5
-0@@ -709,6 +709,11 @@ static inline bool is_module_text_address(unsigned long addr) return false; } +static inline bool within_module(unsigned long addr, const struct module *mod) +{ + return false; +} + /* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) #define symbol_put(x) do { } while (0)
Signature · 2 lines
Thanks, ~Nick Desaulniers