Skip to content

Commit

Permalink
kbuild: prevent modpost from looking for a .cmd file for a static lib…
Browse files Browse the repository at this point in the history
…rary linked into a module

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: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
  • Loading branch information
Ashutosh Naik authored and Sam Ravnborg committed Oct 29, 2008
1 parent 92f83cc commit e6e6733
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/mod/sumversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ static int parse_file(const char *fname, struct md4_ctx *md)
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. */
Expand Down Expand Up @@ -420,7 +429,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
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;
}

Expand Down

0 comments on commit e6e6733

Please sign in to comment.