summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-01-07 12:18:20 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2023-01-22 17:43:33 +0300
commit93c656de8da8b53317bd88ecb7cce592310995d8 (patch)
tree7b719c2a98fdfd24e3d2b03af54dd3aba43ab90f /scripts/basic
parentfaa91c472be8ffa3121c9db803d3e529d48e246a (diff)
downloadlinux-93c656de8da8b53317bd88ecb7cce592310995d8.tar.xz
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 <masahiroy@kernel.org> Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts/basic')
-rw-r--r--scripts/basic/fixdep.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index e22e689de61e..fa562806c2be 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -250,6 +250,15 @@ static int is_ignored_file(const char *s, int len)
str_ends_with(s, len, "include/generated/autoksyms.h");
}
+/* Do not parse these files */
+static int is_no_parse_file(const char *s, int len)
+{
+ /* rustc may list binary files in dep-info */
+ return str_ends_with(s, len, ".rlib") ||
+ str_ends_with(s, len, ".rmeta") ||
+ str_ends_with(s, len, ".so");
+}
+
/*
* Important: The below generated source_foo.o and deps_foo.o variable
* 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)
need_parse = true;
}
- if (need_parse) {
+ if (need_parse && !is_no_parse_file(p, q - p)) {
void *buf;
buf = read_file(p);