At stage 2 modpost utility is used to check modules. In case of unresolved
symbols modpost only prints warning.
IMHO it is a good idea to fail compilation process in case of unresolved
symbols (at least in modules coming with kernel), since usually such errors
are left unnoticed, but kernel modules are broken.
- new option '-w' is added to modpost:
if option is specified, modpost only warns about unresolved symbols
- modpost is called with '-w' for external modules in Makefile.modpost
Signed-off-by: Andrey Mirkin <amirkin@sw.ru>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
+ $(if $(KBUILD_EXTMOD),-w) \
$(wildcard vmlinux) $(filter-out FORCE,$^)
PHONY += __modpost
$(wildcard vmlinux) $(filter-out FORCE,$^)
PHONY += __modpost
static int all_versions = 0;
/* If we are modposting external module set to 1 */
static int external_module = 0;
static int all_versions = 0;
/* If we are modposting external module set to 1 */
static int external_module = 0;
+/* Only warn about unresolved symbols */
+static int warn_unresolved = 0;
/* How a symbol is exported */
enum export {
export_plain, export_unused, export_gpl,
/* How a symbol is exported */
enum export {
export_plain, export_unused, export_gpl,
/**
* Record CRCs for unresolved symbols
**/
/**
* Record CRCs for unresolved symbols
**/
-static void add_versions(struct buffer *b, struct module *mod)
+static int add_versions(struct buffer *b, struct module *mod)
{
struct symbol *s, *exp;
{
struct symbol *s, *exp;
for (s = mod->unres; s; s = s->next) {
exp = find_symbol(s->name);
if (!exp || exp->module == mod) {
for (s = mod->unres; s; s = s->next) {
exp = find_symbol(s->name);
if (!exp || exp->module == mod) {
- if (have_vmlinux && !s->weak)
+ if (have_vmlinux && !s->weak) {
warn("\"%s\" [%s.ko] undefined!\n",
s->name, mod->name);
warn("\"%s\" [%s.ko] undefined!\n",
s->name, mod->name);
+ err = warn_unresolved ? 0 : 1;
+ }
continue;
}
s->module = exp->module;
continue;
}
s->module = exp->module;
buf_printf(b, "\n");
buf_printf(b, "static const struct modversion_info ____versions[]\n");
buf_printf(b, "\n");
buf_printf(b, "static const struct modversion_info ____versions[]\n");
}
static void add_depends(struct buffer *b, struct module *mod,
}
static void add_depends(struct buffer *b, struct module *mod,
char *kernel_read = NULL, *module_read = NULL;
char *dump_write = NULL;
int opt;
char *kernel_read = NULL, *module_read = NULL;
char *dump_write = NULL;
int opt;
- while ((opt = getopt(argc, argv, "i:I:mo:a")) != -1) {
+ while ((opt = getopt(argc, argv, "i:I:mo:aw")) != -1) {
switch(opt) {
case 'i':
kernel_read = optarg;
switch(opt) {
case 'i':
kernel_read = optarg;
case 'a':
all_versions = 1;
break;
case 'a':
all_versions = 1;
break;
+ case 'w':
+ warn_unresolved = 1;
+ break;
for (mod = modules; mod; mod = mod->next) {
if (mod->skip)
continue;
for (mod = modules; mod; mod = mod->next) {
if (mod->skip)
continue;
buf.pos = 0;
add_header(&buf, mod);
buf.pos = 0;
add_header(&buf, mod);
- add_versions(&buf, mod);
+ err |= add_versions(&buf, mod);
add_depends(&buf, mod, modules);
add_moddevtable(&buf, mod);
add_srcversion(&buf, mod);
add_depends(&buf, mod, modules);
add_moddevtable(&buf, mod);
add_srcversion(&buf, mod);
if (dump_write)
write_dump(dump_write);
if (dump_write)
write_dump(dump_write);