From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Miguel Ojeda <ojeda@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH 6/6] fixdep: do not parse *.so, *.rmeta, *.rlib
Date: Sat, 31 Dec 2022 15:42:03 +0900 [thread overview]
Message-ID: <20221231064203.1623793-7-masahiroy@kernel.org> (raw)
In-Reply-To: <20221231064203.1623793-1-masahiroy@kernel.org>
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 *.so, *.rmeta, *rlib to dep-info. fixdep needs them in
the dependency, but there is no point to parse such binary files.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/basic/fixdep.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index cc8f6d34c2ca..b70885116ed2 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 output binary files into 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
@@ -378,7 +387,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);
--
2.34.1
next prev parent reply other threads:[~2022-12-31 6:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 6:41 [PATCH 0/6] kbuild: fix dep-file processing for rust Masahiro Yamada
2022-12-31 6:41 ` [PATCH 1/6] kbuild: specify output names separately for each emission type from rustc Masahiro Yamada
2022-12-31 20:01 ` Gary Guo
2023-01-03 20:44 ` Miguel Ojeda
2023-01-07 9:09 ` Masahiro Yamada
2023-01-06 9:24 ` Vincenzo
2022-12-31 6:41 ` [PATCH 2/6] fixdep: parse Makefile more correctly to handle comments etc Masahiro Yamada
2022-12-31 15:25 ` Miguel Ojeda
2022-12-31 15:30 ` Miguel Ojeda
2023-01-03 20:45 ` Miguel Ojeda
2022-12-31 6:42 ` [PATCH 3/6] kbuild: remove sed commands after rustc rules Masahiro Yamada
2023-01-03 20:45 ` Miguel Ojeda
2023-01-06 9:28 ` Vincenzo
2022-12-31 6:42 ` [PATCH 4/6] fixdep: refactor hash table lookup Masahiro Yamada
2023-01-03 20:45 ` Miguel Ojeda
2022-12-31 6:42 ` [PATCH 5/6] fixdep: avoid parsing the same file over again Masahiro Yamada
2023-01-03 20:46 ` Miguel Ojeda
2023-01-06 9:31 ` Vincenzo
2022-12-31 6:42 ` Masahiro Yamada [this message]
2023-01-03 20:46 ` [PATCH 6/6] fixdep: do not parse *.so, *.rmeta, *.rlib Miguel Ojeda
2022-12-31 13:34 ` [PATCH 0/6] kbuild: fix dep-file processing for rust Miguel Ojeda
2022-12-31 15:05 ` Masahiro Yamada
2023-01-03 20:48 ` Miguel Ojeda
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=20221231064203.1623793-7-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=ojeda@kernel.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