Re: Help needed to fix section mismatch warnings

From: Randy Dunlap
Date: Sat Jan 19 2008 - 14:54:17 EST


On Sun, 6 Jan 2008 15:07:28 +0100 Sam Ravnborg wrote:

> kbuild emit section mismatch warnings when it detects that someone does a
> call from a non-init section to a init section.
> The rationale here is that the init section are discarded at runtime and
> if this call happens after the init section has gone we have an oops.
>
> This check is planned to be turned into an error soon but we still
> see a bit too many warnings.
>
> To see the list below build a kernel like this:
>
> make allyesconfig
> Set CONFIG_HOTPLUG to n
> (In General Setup | Configure standard kernel features | Support for hot-plugable devices)
>
> Then build the kernel like this:
> make KCFLAGS=-fno-unit-at-a-time
>
> The flag "-fno-unit-at-a-time" tell gcc to avoid additional inlining which
> otherwise would hide several section mismatch warnings.
>
> With latest kernel I got 113 warnings and most should fixable.
> Try to look at how other section mismatch warnings has been fixed for inspiration.
>
> Patches can be cc:ed to me but always send it to the maintainer and lkml.
>
> Sam
>
> This is the current list of warnings
>
> WARNING: vmlinux.o(.text+0x1ffd0): Section mismatch: reference to .init.text:register_cpu (between 'arch_register_cpu' and 'arch_unregister_cpu')

> WARNING: vmlinux.o(.text+0x21a39): Section mismatch: reference to .init.text:absent_pages_in_range (between 'reserve_hotadd' and 'unparse_node')
> WARNING: vmlinux.o(.text+0x21ae9): Section mismatch: reference to .init.data: (between 'unparse_node' and 'null_slit_node_compare')

> WARNING: vmlinux.o(.text+0x38b43): Section mismatch: reference to .init.text:idle_regs (between 'fork_idle' and 'fork_traceflag')

Above 4 seem to be mostly fixed in -mm. I made patches for them
and then checked -mm, so I won't post the patches...


> WARNING: vmlinux.o(.text+0x43524): Section mismatch: reference to .init.text: (between 'timer_cpu_notify' and 'msleep')
> WARNING: vmlinux.o(.text+0x4c6f6): Section mismatch: reference to .init.text: (between 'rcu_cpu_notify' and 'wakeme_after_rcu')
> WARNING: vmlinux.o(.text+0x51cbe): Section mismatch: reference to .init.text: (between 'hrtimer_cpu_notify' and 'down_read_trylock')

I'll post patches for the 3 above. However, the rcu code in -mm
is quite different, so the rcu patch may have a short life.

---
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/