mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 15:11:16 +00:00
kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings
Throughout the kernel there are a few legitimite references to init or exit sections. Most of these are covered by the patterns included in modpost but a few nees special attention. To avoid hardcoding a lot of function names in modpost introduce a marker so relevant function/data can be marked. When modpost see a reference to a init/exit function from a function/data marked no warning will be issued. Idea from: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
ca967258b6
commit
0e0d314e6a
3 changed files with 28 additions and 2 deletions
|
@ -45,6 +45,19 @@
|
|||
#define __exitdata __attribute__ ((__section__(".exit.data")))
|
||||
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
|
||||
|
||||
/* modpost check for section mismatches during the kernel build.
|
||||
* A section mismatch happens when there are references from a
|
||||
* code or data section to an init section (both code or data).
|
||||
* The init sections are (for most archs) discarded by the kernel
|
||||
* when early init has completed so all such references are potential bugs.
|
||||
* For exit sections the same issue exists.
|
||||
* The following markers are used for the cases where the reference to
|
||||
* the init/exit section (code or data) is valid and will teach modpost
|
||||
* not to issue a warning.
|
||||
* The markers follow same syntax rules as __init / __initdata. */
|
||||
#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
|
||||
#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
|
||||
|
||||
#ifdef MODULE
|
||||
#define __exit __attribute__ ((__section__(".exit.text")))
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue