Re: [PATCH v1 0/2] Introduce the initify gcc plugin

From: Emese Revfy
Date: Tue Jun 28 2016 - 07:36:14 EST


On Tue, 28 Jun 2016 13:34:07 +0200
Emese Revfy <re.emese@xxxxxxxxx> wrote:

> * automatically discover init/exit functions and apply the __init or
> __exit attributes on them

Hi,

I have a question about this. If a function is called by __init and __exit functions as well then
I move it to the __exit section. I think this is correct because such a function is available to
both __init and __exit functions as well at runtime.
However this generates a section mismatch (from scripts/mod/modpost.c) e.g.,

WARNING: vmlinux.o(.init.text+0x196849): Section mismatch in reference from the function sctp_init() to the function .exit.text:sctp_v4_del_protocol()
The function __init sctp_init() references
a function __exit sctp_v4_del_protocol().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
sctp_v4_del_protocol() so it may be used outside an exit section.

This check was introduced by this commit (588ccd732ba2d):
kbuild: add verbose option to Section mismatch reporting in modpost

If this move doesn't cause a problem then I would like to keep it because there are a lot of functions that can become __exit and I would like to remove this warning.

Thanks
--
Emese