linux内核代码中__cpuinit的真正意义是什么? 我遇到了正常的内核代码,加入了__cpuinit函数。这给了我大量的modpost警告。这是正常的还是严重的错误?
答案 0 :(得分:2)
__ cpuinit实际上告诉编译器将函数放入指定的elf部分。
#define __cpuinit __section(.cpuinit.text) __cold
内核代码在include / linux / init.h中说:
/* 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. ......