Skip to content

Commit a4b6a77

Browse files
James Hoganrustyrussell
authored andcommitted
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: James 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)
1 parent b92021b commit a4b6a77

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎kernel/module.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
12121212
if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL,
12131213
&crc, true, false))
12141214
BUG();
1215-
return check_version(sechdrs, versindex, "module_layout", mod, crc,
1215+
return check_version(sechdrs, versindex,
1216+
VMLINUX_SYMBOL_STR(module_layout), mod, crc,
12161217
NULL);
12171218
}
12181219

‎scripts/mod/modpost.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,8 @@ static int add_versions(struct buffer *b, struct module *mod)
19281928
s->name, mod->name);
19291929
continue;
19301930
}
1931-
buf_printf(b, "\t{ %#8x, \"%s\" },\n", s->crc, s->name);
1931+
buf_printf(b, "\t{ %#8x, VMLINUX_SYMBOL_STR(%s) },\n",
1932+
s->crc, s->name);
19321933
}
19331934

19341935
buf_printf(b, "};\n");

0 commit comments

Comments
 (0)