2021-05-25 07:40:52

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled

Quoting Bixuan Cui (2021-05-25 01:54:00)
> kernel/module.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/module.c b/kernel/module.c
> index decf4601e943..7287ecc76714 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -2794,7 +2794,8 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
> }
> #endif /* CONFIG_KALLSYMS */
>
> -#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
> +#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) && \
> + IS_ENABLED(CONFIG_SYSFS)

Thanks for the report. It is the wrong fix though as we don't care that
sysfs is enabled or not. How about this patch?

---8<---
diff --git a/kernel/module.c b/kernel/module.c
index b5dd92e35b02..5be1f8ea4886 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1462,6 +1462,13 @@ resolve_symbol_wait(struct module *mod,
return ksym;
}

+#ifdef CONFIG_KALLSYMS
+static inline bool sect_empty(const Elf_Shdr *sect)
+{
+ return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
+}
+#endif
+
/*
* /sys/module/foo/sections stuff
* J. Corbet <[email protected]>
@@ -1469,11 +1476,6 @@ resolve_symbol_wait(struct module *mod,
#ifdef CONFIG_SYSFS

#ifdef CONFIG_KALLSYMS
-static inline bool sect_empty(const Elf_Shdr *sect)
-{
- return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
-}
-
struct module_sect_attr {
struct bin_attribute battr;
unsigned long address;


2021-05-25 10:12:48

by Bixuan Cui

[permalink] [raw]
Subject: Re: [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled



On 2021/5/25 15:36, Stephen Boyd wrote:
> Quoting Bixuan Cui (2021-05-25 01:54:00)
>> kernel/module.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/module.c b/kernel/module.c
>> index decf4601e943..7287ecc76714 100644
>> --- a/kernel/module.c
>> +++ b/kernel/module.c
>> @@ -2794,7 +2794,8 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
>> }
>> #endif /* CONFIG_KALLSYMS */
>>
>> -#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
>> +#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) && \
>> + IS_ENABLED(CONFIG_SYSFS)
> Thanks for the report. It is the wrong fix though as we don't care that
> sysfs is enabled or not. How about this patch?
Hello, your patch solves that problem very well. Will you send a new patch?

Thanks
Bixuan Cui