aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-06-01 14:57:05 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2020-06-06 23:36:55 +0900
commit52c3416db00d970c91a6992ab6e5ff48e077ad29 (patch)
tree8eef0a668baa0753233e5cc6732cf0d90e169fca /scripts/mod/modpost.c
parentmodpost: load KBUILD_EXTRA_SYMBOLS files in order (diff)
downloadlinux-dev-52c3416db00d970c91a6992ab6e5ff48e077ad29.tar.xz
linux-dev-52c3416db00d970c91a6992ab6e5ff48e077ad29.zip
modpost: track if the symbol origin is a dump file or ELF object
The meaning of sym->kernel is obscure; it is set for in-kernel symbols loaded from Modules.symvers. This happens only when we are building external modules, and it is used to determine whether to dump symbols to $(KBUILD_EXTMOD)/Modules.symvers It is clearer to remember whether the symbol or module came from a dump file or ELF object. This changes the KBUILD_EXTRA_SYMBOLS behavior. Previously, symbols loaded from KBUILD_EXTRA_SYMBOLS are accumulated into the current $(KBUILD_EXTMOD)/Modules.symvers Going forward, they will be only used to check symbol references, but not dumped into the current $(KBUILD_EXTMOD)/Modules.symvers. I believe this makes more sense. sym->vmlinux will have no user. Remove it too. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to '')
-rw-r--r--scripts/mod/modpost.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 5224a02edbf2..60f35b89cea2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -161,9 +161,6 @@ struct symbol {
int crc_valid;
char *namespace;
unsigned int weak:1;
- unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */
- unsigned int kernel:1; /* 1 if symbol is from kernel
- * (only for external modules) **/
unsigned int is_static:1; /* 1 if symbol is not global */
enum export export; /* Type of export */
char name[];
@@ -398,8 +395,6 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
}
s->module = mod;
- s->vmlinux = is_vmlinux(mod->name);
- s->kernel = 0;
s->export = export;
return s;
}
@@ -2427,7 +2422,7 @@ static void write_if_changed(struct buffer *b, const char *fname)
/* parse Module.symvers file. line format:
* 0x12345678<tab>symbol<tab>module<tab>export<tab>namespace
**/
-static void read_dump(const char *fname, unsigned int kernel)
+static void read_dump(const char *fname)
{
unsigned long size, pos = 0;
void *file = grab_file(fname, &size);
@@ -2465,9 +2460,9 @@ static void read_dump(const char *fname, unsigned int kernel)
have_vmlinux = 1;
mod = new_module(modname);
mod->skip = 1;
+ mod->from_dump = 1;
}
s = sym_add_exported(symname, mod, export_no(export));
- s->kernel = kernel;
s->is_static = 0;
sym_set_crc(symname, crc);
sym_update_namespace(symname, namespace);
@@ -2487,7 +2482,7 @@ static int dump_sym(struct symbol *sym)
{
if (!external_module)
return 1;
- if (sym->vmlinux || sym->kernel)
+ if (sym->module->from_dump)
return 0;
return 1;
}
@@ -2606,11 +2601,11 @@ int main(int argc, char **argv)
}
if (kernel_read)
- read_dump(kernel_read, 1);
+ read_dump(kernel_read);
while (extsym_start) {
struct ext_sym_list *tmp;
- read_dump(extsym_start->file, 0);
+ read_dump(extsym_start->file);
tmp = extsym_start->next;
free(extsym_start);
extsym_start = tmp;