0

linux内核代码中__cpuinit的真正意义是什么?我遇到了访问 __cpuinit 函数的正常内核代码。这给了我大量的 modpost 警告。这是正常的还是严重的错误?

4

1 回答 1

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.  ......
于 2013-10-29T13:14:56.153 回答