Skip to content

Commit e6e6733

Browse files
Ashutosh Naiksravnborg
authored andcommitted
kbuild: prevent modpost from looking for a .cmd file for a static library 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 [[email protected]: coding-style fixes] Signed-off-by: Ashutosh Naik <[email protected]> Cc: Rusty Russell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Sam Ravnborg <[email protected]>
1 parent 92f83cc commit e6e6733

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/mod/sumversion.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,15 @@ static int parse_file(const char *fname, struct md4_ctx *md)
290290
release_file(file, len);
291291
return 1;
292292
}
293+
/* Check whether the file is a static library or not */
294+
static int is_static_library(const char *objfile)
295+
{
296+
int len = strlen(objfile);
297+
if (objfile[len - 2] == '.' && objfile[len - 1] == 'a')
298+
return 1;
299+
else
300+
return 0;
301+
}
293302

294303
/* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to
295304
* figure out source file. */
@@ -420,7 +429,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
420429
while ((fname = strsep(&sources, " ")) != NULL) {
421430
if (!*fname)
422431
continue;
423-
if (!parse_source_files(fname, &md))
432+
if (!(is_static_library(fname)) &&
433+
!parse_source_files(fname, &md))
424434
goto release;
425435
}
426436

0 commit comments

Comments
 (0)