EXPORT_SYMBOL and static in KMODS

In kernel modules, if you have a variable you want to export via EXPORT_SYMBOL, it shouldn’t be static.

static indicates that you won’t be calling that function from outside that file, and EXPORT_SYMBOL does the opposite, that’s the reason for this error message:

1
2
3
4
5
ERROR: modpost: vmlinux: local symbol 'root_stable_tree' was exported
ERROR: modpost: vmlinux: local symbol 'root_unstable_tree' was exported
ERROR: modpost: vmlinux: local symbol 'ksm_mm_head' was exported
ERROR: modpost: vmlinux: local symbol 'ksm_scan' was exported
make[2]: *** [scripts/Makefile.modpost:145: Module.symvers] Error 1