Skip to content

Commit 8cc39a6

Browse files
samitolvanenintel-lab-lkp
authored andcommitted
gendwarfksyms: Skip files with no exports
Starting with Rust 1.91.0 (released 2025-10-30), in upstream commit ab91a63d403b ("Ignore intrinsic calls in cross-crate-inlining cost model") [1][2], `bindings.o` stops containing DWARF debug information because the `Default` implementations contained `write_bytes()` calls which are now ignored in that cost model (note that `CLIPPY=1` does not reproduce it). This means `gendwarfksyms` complains: RUSTC L rust/bindings.o error: gendwarfksyms: process_module: dwarf_get_units failed: no debugging information? There are several alternatives that would work here: conditionally skipping in the cases needed (but that is subtle and brittle), forcing DWARF generation with e.g. a dummy `static` (ugly and we may need to do it in several crates), skipping the call to the tool in the Kbuild command when there are no exports (fine) or teaching the tool to do so itself (simple and clean). Thus do the last one: don't attempt to process files if we have no symbol versions to calculate. [ I used the commit log of my patch linked below since it explained the root issue and expanded it a bit more to summarize the alternatives. - Miguel ] Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs). Reported-by: Haiyue Wang <haiyuewa@163.com> Closes: https://lore.kernel.org/rust-for-linux/b8c1c73d-bf8b-4bf2-beb1-84ffdcd60547@163.com/ Suggested-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/rust-for-linux/CANiq72nKC5r24VHAp9oUPR1HVPqT+=0ab9N0w6GqTF-kJOeiSw@mail.gmail.com/ Link: rust-lang/rust@ab91a63 [1] Link: rust-lang/rust#145910 [2] Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent e9a6fb0 commit 8cc39a6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

scripts/gendwarfksyms/gendwarfksyms.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ int main(int argc, char **argv)
138138
error("no input files?");
139139
}
140140

141-
symbol_read_exports(stdin);
141+
if (!symbol_read_exports(stdin))
142+
return 0;
142143

143144
if (symtypes_file) {
144145
symfile = fopen(symtypes_file, "w");

scripts/gendwarfksyms/gendwarfksyms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct symbol {
123123
typedef void (*symbol_callback_t)(struct symbol *, void *arg);
124124

125125
bool is_symbol_ptr(const char *name);
126-
void symbol_read_exports(FILE *file);
126+
int symbol_read_exports(FILE *file);
127127
void symbol_read_symtab(int fd);
128128
struct symbol *symbol_get(const char *name);
129129
void symbol_set_ptr(struct symbol *sym, Dwarf_Die *ptr);

scripts/gendwarfksyms/symbols.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static bool is_exported(const char *name)
128128
return for_each(name, NULL, NULL) > 0;
129129
}
130130

131-
void symbol_read_exports(FILE *file)
131+
int symbol_read_exports(FILE *file)
132132
{
133133
struct symbol *sym;
134134
char *line = NULL;
@@ -159,6 +159,8 @@ void symbol_read_exports(FILE *file)
159159

160160
free(line);
161161
debug("%d exported symbols", nsym);
162+
163+
return nsym;
162164
}
163165

164166
static void get_symbol(struct symbol *sym, void *arg)

0 commit comments

Comments
 (0)