diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-02-14 08:31:02 -0600 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2003-02-14 08:31:02 -0600 |
| commit | b3e8b7081800ec0452e432d01ae55bc327da4b5f (patch) | |
| tree | 0d3dd73132b0506e96d9de16250f821126e192ee /scripts | |
| parent | 8ed38d8d0aa868c3f273574f4e6b1364e7eb3cbc (diff) | |
kbuild: Add dependency info to modules
During postprocessing, we get the information which modules we depend on
(i.e. which modules export symbols we need to import) for free, so we
record it in .modinfo. This may allow us to remove the "depmod" program
at a later time, though for now it remains working as usual.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/modpost.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/modpost.c b/scripts/modpost.c index 78953ae06c4f..fb8a54414b87 100644 --- a/scripts/modpost.c +++ b/scripts/modpost.c @@ -75,6 +75,7 @@ struct module { struct module *next; const char *name; struct symbol *unres; + int seen; }; static struct module *modules; @@ -318,6 +319,39 @@ add_versions(struct buffer *b, struct module *mod) } void +add_depends(struct buffer *b, struct module *mod, struct module *modules) +{ + struct symbol *s; + struct module *m; + int first = 1; + + for (m = modules; m; m = m->next) { + if (strcmp(m->name, "vmlinux") == 0) + m->seen = 1; + else + m->seen = 0; + } + + buf_printf(b, "\n"); + buf_printf(b, "static const char __module_depends[]\n"); + buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n"); + buf_printf(b, "\"depends="); + for (s = mod->unres; s; s = s->next) { + if (!s->module) + continue; + + if (s->module->seen) + continue; + + s->module->seen = 1; + buf_printf(b, "%s%s", first ? "" : ",", + strrchr(s->module->name, '/') + 1); + first = 0; + } + buf_printf(b, "\";\n"); +} + +void write_if_changed(struct buffer *b, const char *fname) { char *tmp; @@ -387,6 +421,7 @@ main(int argc, char **argv) add_header(&buf); add_versions(&buf, mod); + add_depends(&buf, mod, modules); sprintf(fname, "%s.ver.c", mod->name); write_if_changed(&buf, fname); |
