Message ID | 1345345030-22211-28-git-send-email-andi@firstfloor.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, 18 Aug 2012 19:56:23 -0700, Andi Kleen <andi@firstfloor.org> wrote: > @@ -78,11 +78,13 @@ extern struct module __this_module; > > #else /* !CONFIG_MODULES... */ > > -#define EXPORT_SYMBOL(sym) > -#define EXPORT_SYMBOL_GPL(sym) > -#define EXPORT_SYMBOL_GPL_FUTURE(sym) > -#define EXPORT_UNUSED_SYMBOL(sym) > -#define EXPORT_UNUSED_SYMBOL_GPL(sym) > +/* Even without modules keep the __visible side effect */ > + > +#define EXPORT_SYMBOL(sym) extern typeof(sym) sym __visible > +#define EXPORT_SYMBOL_GPL(sym) extern typeof(sym) sym __visible > +#define EXPORT_SYMBOL_GPL_FUTURE(sym) extern typeof(sym) sym __visible > +#define EXPORT_UNUSED_SYMBOL(sym) extern typeof(sym) sym __visible > +#define EXPORT_UNUSED_SYMBOL_GPL(sym) extern typeof(sym) sym __visible > > #endif /* CONFIG_MODULES */ Really, why? Seems like a win to have them eliminated if unused. Naively, I would think many cases of __visible should be #ifdef CONFIG_MODULES. What am I missing? Thanks, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> Really, why? Seems like a win to have them eliminated if unused. > > Naively, I would think many cases of __visible should be #ifdef > CONFIG_MODULES. What am I missing? It worked around some problem I forgot now :) You're right it shouldn't be needed in theory for !MODULES. I'll double check. -Andi
diff --git a/include/linux/export.h b/include/linux/export.h index 696c0f4..784617e 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -47,7 +47,7 @@ extern struct module __this_module; /* For every exported symbol, place a struct in the __ksymtab section */ #define __EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ + extern typeof(sym) sym __visible; \ __CRC_SYMBOL(sym, sec) \ static const char __kstrtab_##sym[] \ __attribute__((section("__ksymtab_strings"), aligned(1))) \ @@ -78,11 +78,13 @@ extern struct module __this_module; #else /* !CONFIG_MODULES... */ -#define EXPORT_SYMBOL(sym) -#define EXPORT_SYMBOL_GPL(sym) -#define EXPORT_SYMBOL_GPL_FUTURE(sym) -#define EXPORT_UNUSED_SYMBOL(sym) -#define EXPORT_UNUSED_SYMBOL_GPL(sym) +/* Even without modules keep the __visible side effect */ + +#define EXPORT_SYMBOL(sym) extern typeof(sym) sym __visible +#define EXPORT_SYMBOL_GPL(sym) extern typeof(sym) sym __visible +#define EXPORT_SYMBOL_GPL_FUTURE(sym) extern typeof(sym) sym __visible +#define EXPORT_UNUSED_SYMBOL(sym) extern typeof(sym) sym __visible +#define EXPORT_UNUSED_SYMBOL_GPL(sym) extern typeof(sym) sym __visible #endif /* CONFIG_MODULES */