Skip to contentSkip to conversation

Get modpost to work properly with vmlinux in a different directory

PATCH In review Bryan O'Sullivan 2 participants 2 messages Dec 17, 2003 – Dec 22, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Get modpost to work properly with vmlinux in a different directory

This is pretty trivial. 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.

Since it's not critical, I'd call it a contender for -mm and 2.6.1.

	<b
 scripts/modpost.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1509 -> 1.1510
# scripts/modpost.c 1.15 -> 1.16
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/17 [email protected] 1.1510
# Make detection of whether a module is really vmlinux work regardless of its location. # --------------------------------------------
#

scripts/modpost.c +16 -7
diff -Nru a/scripts/modpost.c b/scripts/modpost.c
@@ -324,6 +324,19 @@
 	}
 }
 
+int
+is_vmlinux(const char *modname)
+{
+	const char *myname;
+	
+	if ((myname = strrchr(modname, '/')))
+		myname++;
+	else
+		myname = modname;
+
+	return strcmp(myname, "vmlinux") == 0;
+}
+
 void
 read_symbols(char *modname)
 {
@@ -335,8 +348,7 @@
 
 	/* When there's no vmlinux, don't print warnings about
 	 * unresolved symbols (since there'll be too many ;) */
-	if (strcmp(modname, "vmlinux") == 0)
-		have_vmlinux = 1;
+	have_vmlinux = is_vmlinux(modname);
 
 	parse_elf(&info, modname);
 
@@ -460,10 +472,7 @@
 	int first = 1;
 
 	for (m = modules; m; m = m->next) {
-		if (strcmp(m->name, "vmlinux") == 0)
-			m->seen = 1;
-		else 
-			m->seen = 0;
+		m->seen = is_vmlinux(m->name);
 	}
 
 	buf_printf(b, "\n");
@@ -543,7 +552,7 @@
 	}
 
 	for (mod = modules; mod; mod = mod->next) {
-		if (strcmp(mod->name, "vmlinux") == 0)
+		if (is_vmlinux(mod->name))
 			continue;
 
 		buf.pos = 0;
#1 lore raw
Quoted 3 lines · On Wed, 17 Dec 2003 13:56:27 -0800 Bryan O'Sullivan <[email protected]> wrote:

This is pretty trivial. 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.

Thanks, I've taken it. I'll push to Andrew once things have calmed down.

Thanks,
Rusty.

Signature · 2 lines
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy