Commit 8f36d53f authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: Bogus "has no CRC" in external module builds

From: Pavel Roskin <proski@gnu.org>
The recent fixes for the external module build have fixed the major
breakage, but they left one annoyance unfixed.  If CONFIG_MODVERSIONS is
disabled, a warning is printed for every exported symbol that is has no
CRC.  For instance, I see this when compiling the standalone Orinoco
driver on Linux 2.6.6-rc3:

*** Warning: "__orinoco_down" [/usr/local/src/orinoco/spectrum_cs.ko] has
no CRC!
*** Warning: "hermes_struct_init" [/usr/local/src/orinoco/spectrum_cs.ko]
has no CRC!
*** Warning: "free_orinocodev" [/usr/local/src/orinoco/spectrum_cs.ko] has
no CRC!
[further warnings skipped]

I have found that the "-i" option for modpost is used for external builds,
whereas the internal modules use "-o".  The "-i" option causes read_dump()
in modpost.c to be called.  This function sets "modversions" variable
under some conditions that I don't understand.  The comment before the
modversions declarations says: "Are we using CONFIG_MODVERSIONS?"

Apparently modpost fails to answer this question.  I think it's better to
use an explicit option rather than a kludge.

The attached patch adds a new option "-m" that is specified if and only if
CONFIG_MODVERSIONS is enabled.  The patch has been successfully tested
both with and without CONFIG_MODVERSIONS.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent df9b2cba
...@@ -51,6 +51,7 @@ _modpost: $(modules) ...@@ -51,6 +51,7 @@ _modpost: $(modules)
# Includes step 3,4 # Includes step 3,4
quiet_cmd_modpost = MODPOST quiet_cmd_modpost = MODPOST
cmd_modpost = scripts/mod/modpost \ cmd_modpost = scripts/mod/modpost \
$(if $(CONFIG_MODVERSIONS),-m) \
$(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \
$(filter-out FORCE,$^) $(filter-out FORCE,$^)
......
...@@ -343,7 +343,6 @@ handle_modversions(struct module *mod, struct elf_info *info, ...@@ -343,7 +343,6 @@ handle_modversions(struct module *mod, struct elf_info *info,
crc = (unsigned int) sym->st_value; crc = (unsigned int) sym->st_value;
add_exported_symbol(symname + strlen(CRC_PFX), add_exported_symbol(symname + strlen(CRC_PFX),
mod, &crc); mod, &crc);
modversions = 1;
} }
break; break;
case SHN_UNDEF: case SHN_UNDEF:
...@@ -649,7 +648,6 @@ read_dump(const char *fname) ...@@ -649,7 +648,6 @@ read_dump(const char *fname)
if (!(mod = find_module(modname))) { if (!(mod = find_module(modname))) {
if (is_vmlinux(modname)) { if (is_vmlinux(modname)) {
modversions = 1;
have_vmlinux = 1; have_vmlinux = 1;
} }
mod = new_module(NOFAIL(strdup(modname))); mod = new_module(NOFAIL(strdup(modname)));
...@@ -696,11 +694,14 @@ main(int argc, char **argv) ...@@ -696,11 +694,14 @@ main(int argc, char **argv)
char *dump_read = NULL, *dump_write = NULL; char *dump_read = NULL, *dump_write = NULL;
int opt; int opt;
while ((opt = getopt(argc, argv, "i:o:")) != -1) { while ((opt = getopt(argc, argv, "i:mo:")) != -1) {
switch(opt) { switch(opt) {
case 'i': case 'i':
dump_read = optarg; dump_read = optarg;
break; break;
case 'm':
modversions = 1;
break;
case 'o': case 'o':
dump_write = optarg; dump_write = optarg;
break; break;
......
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