Commit d8c1eb86 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michal Marek

kbuild: modpost warn if export version crc is missing

This catches the failing ceph CRC on with:

    LD      vmlinux.o
    MODPOST vmlinux.o
  WARNING: EXPORT symbol "ceph_monc_do_statfs" [vmlinux] version
  generation failed, symbol will not be versioned.

When the modules referring to exported symbols are built, there is an
existing warning for missing CRC, but it's not always the case such
any such module will be built, and in any case it is useful to get a
warning at the source.

This gets a little verbose with CONFIG_DEBUG_SECTION_MISMATCH,
producing a warning with each object linked, but I didn't think
that warranted extra complexity to avoid.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
parent 4b89b7f7
...@@ -609,6 +609,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -609,6 +609,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
{ {
unsigned int crc; unsigned int crc;
enum export export; enum export export;
bool is_crc = false;
if ((!is_vmlinux(mod->name) || mod->is_dot_o) && if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
strncmp(symname, "__ksymtab", 9) == 0) strncmp(symname, "__ksymtab", 9) == 0)
...@@ -618,6 +619,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -618,6 +619,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
/* CRC'd symbol */ /* CRC'd symbol */
if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
is_crc = true;
crc = (unsigned int) sym->st_value; crc = (unsigned int) sym->st_value;
sym_update_crc(symname + strlen(CRC_PFX), mod, crc, sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
export); export);
...@@ -663,6 +665,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -663,6 +665,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
else else
symname++; symname++;
#endif #endif
if (is_crc) {
const char *e = is_vmlinux(mod->name) ?"":".ko";
warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n", symname + strlen(CRC_PFX), mod->name, e);
}
mod->unres = alloc_symbol(symname, mod->unres = alloc_symbol(symname,
ELF_ST_BIND(sym->st_info) == STB_WEAK, ELF_ST_BIND(sym->st_info) == STB_WEAK,
mod->unres); mod->unres);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment