Commit e5d9d44e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Get modpost to work properly with vmlinux in a different directory

From: "Bryan O'Sullivan" <bos@pathscale.com>

The current version of modpost breaks if invoked from outside the build
tree.  This patch fixes that, and simplifies the code a bit while it's at
it.
parent 67fbc534
...@@ -324,6 +324,19 @@ handle_modversions(struct module *mod, struct elf_info *info, ...@@ -324,6 +324,19 @@ handle_modversions(struct module *mod, struct elf_info *info,
} }
} }
int
is_vmlinux(const char *modname)
{
const char *myname;
if ((myname = strrchr(modname, '/')))
myname++;
else
myname = modname;
return strcmp(myname, "vmlinux") == 0;
}
void void
read_symbols(char *modname) read_symbols(char *modname)
{ {
...@@ -335,8 +348,7 @@ read_symbols(char *modname) ...@@ -335,8 +348,7 @@ read_symbols(char *modname)
/* When there's no vmlinux, don't print warnings about /* When there's no vmlinux, don't print warnings about
* unresolved symbols (since there'll be too many ;) */ * unresolved symbols (since there'll be too many ;) */
if (strcmp(modname, "vmlinux") == 0) have_vmlinux = is_vmlinux(modname);
have_vmlinux = 1;
parse_elf(&info, modname); parse_elf(&info, modname);
...@@ -460,10 +472,7 @@ add_depends(struct buffer *b, struct module *mod, struct module *modules) ...@@ -460,10 +472,7 @@ add_depends(struct buffer *b, struct module *mod, struct module *modules)
int first = 1; int first = 1;
for (m = modules; m; m = m->next) { for (m = modules; m; m = m->next) {
if (strcmp(m->name, "vmlinux") == 0) m->seen = is_vmlinux(m->name);
m->seen = 1;
else
m->seen = 0;
} }
buf_printf(b, "\n"); buf_printf(b, "\n");
...@@ -543,7 +552,7 @@ main(int argc, char **argv) ...@@ -543,7 +552,7 @@ main(int argc, char **argv)
} }
for (mod = modules; mod; mod = mod->next) { for (mod = modules; mod; mod = mod->next) {
if (strcmp(mod->name, "vmlinux") == 0) if (is_vmlinux(mod->name))
continue; continue;
buf.pos = 0; buf.pos = 0;
......
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