提交 a4b6a77b 编写于 作者: J James Hogan 提交者: Rusty Russell

module: fix symbol versioning with symbol prefixes

Fix symbol versioning on architectures with symbol prefixes. Although
the build was free from warnings the actual modules still wouldn't load
as the ____versions table contained unprefixed symbol names, which were
being compared against the prefixed symbol names when checking the
symbol versions.

This is fixed by modifying modpost to add the symbol prefix to the
____versions table it outputs (Modules.symvers still contains unprefixed
symbol names). The check_modstruct_version() function is also fixed as
it checks the version of the unprefixed "module_layout" symbol which
would no longer work.
Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Kliegman <kliegs@chromium.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (use VMLINUX_SYMBOL_STR)
上级 b92021b0
...@@ -1212,7 +1212,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, ...@@ -1212,7 +1212,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL, if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL,
&crc, true, false)) &crc, true, false))
BUG(); BUG();
return check_version(sechdrs, versindex, "module_layout", mod, crc, return check_version(sechdrs, versindex,
VMLINUX_SYMBOL_STR(module_layout), mod, crc,
NULL); NULL);
} }
......
...@@ -1928,7 +1928,8 @@ static int add_versions(struct buffer *b, struct module *mod) ...@@ -1928,7 +1928,8 @@ static int add_versions(struct buffer *b, struct module *mod)
s->name, mod->name); s->name, mod->name);
continue; continue;
} }
buf_printf(b, "\t{ %#8x, \"%s\" },\n", s->crc, s->name); buf_printf(b, "\t{ %#8x, VMLINUX_SYMBOL_STR(%s) },\n",
s->crc, s->name);
} }
buf_printf(b, "};\n"); buf_printf(b, "};\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册