Skip to content

Commit e0f244c

Browse files
Andi Kleenrustyrussell
authored andcommitted
asmlinkage, module: Make ksymtab and kcrctab symbols and __this_module __visible
Make the ksymtab symbols for EXPORT_SYMBOL visible. This prevents the LTO compiler from adding a .NUMBER prefix, which avoids various problems in later export processing. Cc: rusty@rustcorp.com.au Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent eb3057d commit e0f244c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎include/linux/export.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern struct module __this_module;
4343
/* Mark the CRC weak since genksyms apparently decides not to
4444
* generate a checksums for some symbols */
4545
#define __CRC_SYMBOL(sym, sec) \
46-
extern void *__crc_##sym __attribute__((weak)); \
46+
extern __visible void *__crc_##sym __attribute__((weak)); \
4747
static const unsigned long __kcrctab_##sym \
4848
__used \
4949
__attribute__((section("___kcrctab" sec "+" #sym), unused)) \
@@ -59,7 +59,7 @@ extern struct module __this_module;
5959
static const char __kstrtab_##sym[] \
6060
__attribute__((section("__ksymtab_strings"), aligned(1))) \
6161
= VMLINUX_SYMBOL_STR(sym); \
62-
static const struct kernel_symbol __ksymtab_##sym \
62+
__visible const struct kernel_symbol __ksymtab_##sym \
6363
__used \
6464
__attribute__((section("___ksymtab" sec "+" #sym), unused)) \
6565
= { (unsigned long)&sym, __kstrtab_##sym }

‎scripts/mod/modpost.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ static void add_header(struct buffer *b, struct module *mod)
18611861
buf_printf(b, "\n");
18621862
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
18631863
buf_printf(b, "\n");
1864-
buf_printf(b, "struct module __this_module\n");
1864+
buf_printf(b, "__visible struct module __this_module\n");
18651865
buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
18661866
buf_printf(b, "\t.name = KBUILD_MODNAME,\n");
18671867
if (mod->has_init)

0 commit comments

Comments
 (0)