public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: sam@ravnborg.org
Cc: linux-kbuild@vger.kernel.org, akpm@linux-foundation.org,
	ashutosh@chelsio.com, ashutosh.naik@gmail.com,
	rusty@rustcorp.com.au
Subject: [patch 10/13] kbuild: prevent modpost from looking for a .cmd file for a static library linked into a module
Date: Wed, 29 Oct 2008 14:20:12 -0700	[thread overview]
Message-ID: <200810292120.m9TLKCJP019376@imap1.linux-foundation.org> (raw)

From: "Ashutosh Naik" <ashutosh@chelsio.com>

This fixes a compile time warning which occurs whenever a static library
is linked into a kernel module.  MODPOST tries to look for a
".<modulename>.cmd" file to look for its dependencies, but that file
doesn't exist or get generated for static libraries.

This patch prevents modpost from looking for a .cmd file when a module is
linked with a static library

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Ashutosh Naik <ashutosh.naik@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 scripts/mod/sumversion.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff -puN scripts/mod/sumversion.c~kbuild-prevent-modpost-from-looking-for-a-cmd-file-for-a-static-library-linked-into-a-module scripts/mod/sumversion.c
--- a/scripts/mod/sumversion.c~kbuild-prevent-modpost-from-looking-for-a-cmd-file-for-a-static-library-linked-into-a-module
+++ a/scripts/mod/sumversion.c
@@ -290,6 +290,15 @@ static int parse_file(const char *fname,
 	release_file(file, len);
 	return 1;
 }
+/* Check whether the file is a static library or not */
+static int is_static_library(const char *objfile)
+{
+	int len = strlen(objfile);
+	if (objfile[len - 2] == '.' && objfile[len - 1] == 'a')
+		return 1;
+	else
+		return 0;
+}
 
 /* We have dir/file.o.  Open dir/.file.o.cmd, look for deps_ line to
  * figure out source file. */
@@ -420,7 +429,8 @@ void get_src_version(const char *modname
 	while ((fname = strsep(&sources, " ")) != NULL) {
 		if (!*fname)
 			continue;
-		if (!parse_source_files(fname, &md))
+		if (!(is_static_library(fname)) &&
+				!parse_source_files(fname, &md))
 			goto release;
 	}
 
_

                 reply	other threads:[~2008-10-29 21:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200810292120.m9TLKCJP019376@imap1.linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ashutosh.naik@gmail.com \
    --cc=ashutosh@chelsio.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox