浏览代码

[MODULES]: Don't allow statically declared exports

Add an extern declaration for exported symbols to make the compiler warn
on symbols declared statically.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Patrick McHardy 19 年之前
父节点
当前提交
a1a8feed17
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      include/linux/module.h

+ 1 - 0
include/linux/module.h

@@ -183,6 +183,7 @@ void *__symbol_get_gpl(const char *symbol);
 
 
 /* For every exported symbol, place a struct in the __ksymtab section */
 /* For every exported symbol, place a struct in the __ksymtab section */
 #define __EXPORT_SYMBOL(sym, sec)				\
 #define __EXPORT_SYMBOL(sym, sec)				\
+	extern typeof(sym) sym;					\
 	__CRC_SYMBOL(sym, sec)					\
 	__CRC_SYMBOL(sym, sec)					\
 	static const char __kstrtab_##sym[]			\
 	static const char __kstrtab_##sym[]			\
 	__attribute__((section("__ksymtab_strings")))		\
 	__attribute__((section("__ksymtab_strings")))		\