From: Matthew Maurer <mmaurer@google.com>
To: masahiroy@kernel.org, ndesaulniers@google.com, ojeda@kernel.org,
gary@garyguo.net, mcgrof@kernel.org,
Alex Gaynor <alex.gaynor@gmail.com>
Cc: rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, neal@gompa.dev, marcan@marcan.st,
j@jannau.net, asahi@lists.linux.dev,
linux-modules@vger.kernel.org,
"Matthew Maurer" <mmaurer@google.com>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nicolas@fjasle.eu>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>
Subject: [PATCH v5 15/16] modpost: Produce extended modversion information
Date: Wed, 25 Sep 2024 23:38:30 +0000 [thread overview]
Message-ID: <20240925233854.90072-16-mmaurer@google.com> (raw)
In-Reply-To: <20240925233854.90072-1-mmaurer@google.com>
Generate both the existing modversions format and the new extended one
when running modpost.
We no longer generate an error on long symbols in modpost, as they can
now be appropriately encoded in the extended section. These symbols will
be skipped in the previous encoding.
Signed-off-by: Matthew Maurer <mmaurer@google.com>
---
scripts/mod/modpost.c | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 107393a8c48a..f8b7b793d2a2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1840,15 +1840,48 @@ static void add_versions(struct buffer *b, struct module *mod)
continue;
}
if (strlen(s->name) >= MODULE_NAME_LEN) {
- error("too long symbol \"%s\" [%s.ko]\n",
- s->name, mod->name);
- break;
+ /* this symbol will only be in the extended info */
+ continue;
}
buf_printf(b, "\t{ %#8x, \"%s\" },\n",
s->crc, s->name);
}
buf_printf(b, "};\n");
+
+ buf_printf(b, "static const s32 ____version_ext_crcs[]\n");
+ buf_printf(b, "__used __section(\"__version_ext_crcs\") = {\n");
+ list_for_each_entry(s, &mod->unresolved_symbols, list) {
+ if (!s->module)
+ continue;
+ if (!s->crc_valid) {
+ /*
+ * We already warned on this when producing the legacy
+ * modversions table.
+ */
+ continue;
+ }
+ buf_printf(b, "\t%#8x,\n", s->crc);
+ }
+ buf_printf(b, "};\n");
+
+ buf_printf(b, "static const char ____version_ext_names[]\n");
+ buf_printf(b, "__used __section(\"__version_ext_names\") =\n");
+ list_for_each_entry(s, &mod->unresolved_symbols, list) {
+ if (!s->module)
+ continue;
+ if (!s->crc_valid) {
+ /*
+ * We already warned on this when producing the legacy
+ * modversions table.
+ * We need to skip its name too, as the indexes in
+ * both tables need to align.
+ */
+ continue;
+ }
+ buf_printf(b, "\t\"%s\\0\"\n", s->name);
+ }
+ buf_printf(b, ";\n");
}
static void add_depends(struct buffer *b, struct module *mod)
--
2.46.1.824.gd892dcdcdd-goog
next prev parent reply other threads:[~2024-09-25 23:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 23:38 [PATCH v5 00/16] Extended MODVERSIONS Support Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 01/16] module: Take const arg in validate_section_offset Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 02/16] module: Factor out elf_validity_ehdr Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 03/16] module: Factor out elf_validity_cache_sechdrs Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 04/16] module: Factor out elf_validity_cache_secstrings Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 05/16] module: Factor out elf_validity_cache_index_info Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 06/16] module: Factor out elf_validity_cache_index_mod Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 07/16] module: Factor out elf_validity_cache_index_sym Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 08/16] module: Factor out elf_validity_cache_index_str Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 09/16] module: Group section index calculations together Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 10/16] module: Factor out elf_validity_cache_strtab Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 11/16] module: Additional validation in elf_validity_cache_strtab Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 12/16] module: Reformat struct for code style Matthew Maurer
2024-09-25 23:38 ` [PATCH v5 13/16] export_report: Rehabilitate script Matthew Maurer
2024-10-11 22:13 ` Luis Chamberlain
2024-10-11 22:22 ` Matthew Maurer
2024-10-11 22:29 ` Luis Chamberlain
2024-09-25 23:38 ` [PATCH v5 14/16] modules: Support extended MODVERSIONS info Matthew Maurer
2024-09-26 12:22 ` Christophe Leroy
2024-09-26 18:36 ` Sami Tolvanen
2024-10-11 22:22 ` Luis Chamberlain
2024-10-11 22:27 ` Matthew Maurer
2024-10-11 22:33 ` Luis Chamberlain
2024-10-11 23:45 ` Luis Chamberlain
2024-10-11 23:46 ` Luis Chamberlain
2024-10-15 23:22 ` Matthew Maurer
2024-10-16 23:21 ` Luis Chamberlain
2024-10-17 4:41 ` Christophe Leroy
2024-10-17 12:08 ` Helge Deller
2024-10-19 20:45 ` Luis Chamberlain
2024-10-21 19:35 ` Luis Chamberlain
2024-09-25 23:38 ` Matthew Maurer [this message]
2024-09-25 23:38 ` [PATCH v5 16/16] export_report: Use new version info format Matthew Maurer
2024-09-26 22:53 ` [PATCH v5 00/16] Extended MODVERSIONS Support Sami Tolvanen
2024-09-28 21:35 ` Neal Gompa
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=20240925233854.90072-16-mmaurer@google.com \
--to=mmaurer@google.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=asahi@lists.linux.dev \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=j@jannau.net \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=neal@gompa.dev \
--cc=nicolas@fjasle.eu \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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