Skip to content

Commit 93c656d

Browse files
committed
fixdep: do not parse *.rlib, *.rmeta, *.so
fixdep is designed only for parsing text files. read_file() appends a terminating null byte ('\0') and parse_config_file() calls strstr() to search for CONFIG options. rustc outputs *.rlib, *.rmeta, *.so to dep-info. fixdep needs them in the dependency, but there is no point in parsing such binary files. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Tested-by: Miguel Ojeda <[email protected]>
1 parent faa91c4 commit 93c656d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

scripts/basic/fixdep.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ static int is_ignored_file(const char *s, int len)
250250
str_ends_with(s, len, "include/generated/autoksyms.h");
251251
}
252252

253+
/* Do not parse these files */
254+
static int is_no_parse_file(const char *s, int len)
255+
{
256+
/* rustc may list binary files in dep-info */
257+
return str_ends_with(s, len, ".rlib") ||
258+
str_ends_with(s, len, ".rmeta") ||
259+
str_ends_with(s, len, ".so");
260+
}
261+
253262
/*
254263
* Important: The below generated source_foo.o and deps_foo.o variable
255264
* assignments are parsed not only by make, but also by the rather simple
@@ -382,7 +391,7 @@ static void parse_dep_file(char *p, const char *target)
382391
need_parse = true;
383392
}
384393

385-
if (need_parse) {
394+
if (need_parse && !is_no_parse_file(p, q - p)) {
386395
void *buf;
387396

388397
buf = read_file(p);

0 commit comments

Comments
 (0)