Re: [kbuild-all] Re: WARNING: modpost: vmlinux.o(.text.unlikely+0x2c44): Section mismatch in reference from the function trace_define_generic_fields() to the variable .init.data:initcall_level_names
From: Steven Rostedt
Date: Mon Jan 17 2022 - 10:14:21 EST
On Mon, 17 Jan 2022 16:32:38 +0800
"Chen, Rong A" <rong.a.chen@xxxxxxxxx> wrote:
> >
> > Please tell me where initcall_level_names is being referenced?
> >
> > Either fix the compiler or tell me exactly what the bug is. Otherwise, stop
> > sending me this.
> >
> > -- Steve
>
> Hi Steve,
>
> I'm not familiar with the code, the warning can be silenced with the
> below change:
>
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -162,7 +162,7 @@ EXPORT_SYMBOL_GPL(trace_define_field);
> if (ret) \
> return ret;
>
> -static int trace_define_generic_fields(void)
> +static __init int trace_define_generic_fields(void)
> {
> int ret;
>
> @@ -174,7 +174,7 @@ static int trace_define_generic_fields(void)
> return ret;
> }
>
> -static int trace_define_common_fields(void)
> +static __init int trace_define_common_fields(void)
> {
> int ret;
> struct trace_entry ent;
>
> If the warning can't be fixed, we'll add the warning to the ignore list.
>
So the issue is that an __init function calls a static function that
isn't marked as __init?
I guess it can be updated, but seriously, there's nothing bad that can
happen with the above, and it still looks to me as an over aggressive
compiler.
-- Steve