diff options
Diffstat (limited to 'scripts/mod/modpost.c')
| -rw-r--r-- | scripts/mod/modpost.c | 50 | 
1 files changed, 19 insertions, 31 deletions
| diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 24725e50c7b4..3e623ccc020b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -23,8 +23,6 @@  /* Are we using CONFIG_MODVERSIONS? */  static int modversions = 0; -/* Warn about undefined symbols? (do so if we have vmlinux) */ -static int have_vmlinux = 0;  /* Is CONFIG_MODULE_SRCVERSION_ALL set? */  static int all_versions = 0;  /* If we are modposting external module set to 1 */ @@ -41,6 +39,13 @@ static int allow_missing_ns_imports;  static bool error_occurred; +/* + * Cut off the warnings when there are too many. This typically occurs when + * vmlinux is missing. ('make modules' without building vmlinux.) + */ +#define MAX_UNRESOLVED_REPORTS	10 +static unsigned int nr_unresolved; +  enum export {  	export_plain,  	export_gpl, @@ -177,9 +182,6 @@ static struct module *new_module(const char *modname)  	mod->next = modules;  	modules = mod; -	if (mod->is_vmlinux) -		have_vmlinux = 1; -  	return mod;  } @@ -202,7 +204,7 @@ struct symbol {  static struct symbol *symbolhash[SYMBOL_HASH_SIZE]; -/* This is based on the hash agorithm from gdbm, via tdb */ +/* This is based on the hash algorithm from gdbm, via tdb */  static inline unsigned int tdb_hash(const char *name)  {  	unsigned value;	/* Used to compute the hash value.  */ @@ -985,7 +987,7 @@ enum mismatch {  };  /** - * Describe how to match sections on different criterias: + * Describe how to match sections on different criteria:   *   * @fromsec: Array of sections to be matched.   * @@ -993,12 +995,12 @@ enum mismatch {   * this array is forbidden (black-list).  Can be empty.   *   * @good_tosec: Relocations applied to a section in @fromsec must be - * targetting sections in this array (white-list).  Can be empty. + * targeting sections in this array (white-list).  Can be empty.   *   * @mismatch: Type of mismatch.   *   * @symbol_white_list: Do not match a relocation to a symbol in this list - * even if it is targetting a section in @bad_to_sec. + * even if it is targeting a section in @bad_to_sec.   *   * @handler: Specific handler to call when a match is found.  If NULL,   * default_mismatch_handler() will be called. @@ -2141,7 +2143,7 @@ static void check_exports(struct module *mod)  		const char *basename;  		exp = find_symbol(s->name);  		if (!exp || exp->module == mod) { -			if (have_vmlinux && !s->weak) +			if (!s->weak && nr_unresolved++ < MAX_UNRESOLVED_REPORTS)  				modpost_log(warn_unresolved ? LOG_WARN : LOG_ERROR,  					    "\"%s\" [%s.ko] undefined!\n",  					    s->name, mod->name); @@ -2191,10 +2193,12 @@ static void add_header(struct buffer *b, struct module *mod)  	 */  	buf_printf(b, "#define INCLUDE_VERMAGIC\n");  	buf_printf(b, "#include <linux/build-salt.h>\n"); +	buf_printf(b, "#include <linux/elfnote-lto.h>\n");  	buf_printf(b, "#include <linux/vermagic.h>\n");  	buf_printf(b, "#include <linux/compiler.h>\n");  	buf_printf(b, "\n");  	buf_printf(b, "BUILD_SALT;\n"); +	buf_printf(b, "BUILD_LTO_INFO;\n");  	buf_printf(b, "\n");  	buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");  	buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); @@ -2423,19 +2427,6 @@ fail:  	fatal("parse error in symbol dump file\n");  } -/* For normal builds always dump all symbols. - * For external modules only dump symbols - * that are not read from kernel Module.symvers. - **/ -static int dump_sym(struct symbol *sym) -{ -	if (!external_module) -		return 1; -	if (sym->module->from_dump) -		return 0; -	return 1; -} -  static void write_dump(const char *fname)  {  	struct buffer buf = { }; @@ -2446,7 +2437,7 @@ static void write_dump(const char *fname)  	for (n = 0; n < SYMBOL_HASH_SIZE ; n++) {  		symbol = symbolhash[n];  		while (symbol) { -			if (dump_sym(symbol)) { +			if (!symbol->module->from_dump) {  				namespace = symbol->namespace;  				buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n",  					   symbol->crc, symbol->name, @@ -2558,13 +2549,6 @@ int main(int argc, char **argv)  	if (files_source)  		read_symbols_from_files(files_source); -	/* -	 * When there's no vmlinux, don't print warnings about -	 * unresolved symbols (since there'll be too many ;) -	 */ -	if (!have_vmlinux) -		warn("Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.\n"); -  	for (mod = modules; mod; mod = mod->next) {  		char fname[PATH_MAX]; @@ -2608,6 +2592,10 @@ int main(int argc, char **argv)  		}  	} +	if (nr_unresolved > MAX_UNRESOLVED_REPORTS) +		warn("suppressed %u unresolved symbol warnings because there were too many)\n", +		     nr_unresolved - MAX_UNRESOLVED_REPORTS); +  	free(buf.p);  	return error_occurred ? 1 : 0; | 
