On Sat, Nov 08, 2025 at 05:04:06AM +0100, Miguel Ojeda wrote: > On Sat, Nov 8, 2025 at 4:51 AM Miguel Ojeda > <[email protected]> wrote: > > > > What do you mean? > > Do you mean in some cases? i.e. like with `CLIPPY=1`?
Ah, nevermind. I was looking at a stale object file. If there are no exports, we should obviously skip gendwarfksyms. For C objects, we use nm to check for __export_symbol_* symbols before we attempt to generate symbol versions (see gen_symversions in scripts/Makefile.build). We could do something similar for Rust objects too, or just bail out early in gendwarfksyms if it's passed an empty symbol list. The trivial patch below should fix the issue. Sami --- >From d1a4096cd328beae3323a1beb207c7cb5e770770 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen <[email protected]> Date: Sat, 8 Nov 2025 04:26:10 +0000 Subject: [PATCH] gendwarfksyms: Skip files with no exports Don't attempt to process files if we have no symbol versions to calculate. Signed-off-by: Sami Tolvanen <[email protected]> --- scripts/gendwarfksyms/gendwarfksyms.c | 3 ++- scripts/gendwarfksyms/gendwarfksyms.h | 2 +- scripts/gendwarfksyms/symbols.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/gendwarfksyms/gendwarfksyms.c b/scripts/gendwarfksyms/gendwarfksyms.c index 08ae61eb327e..f5203d1640ee 100644 --- a/scripts/gendwarfksyms/gendwarfksyms.c +++ b/scripts/gendwarfksyms/gendwarfksyms.c @@ -138,7 +138,8 @@ int main(int argc, char **argv) error("no input files?"); } - symbol_read_exports(stdin); + if (!symbol_read_exports(stdin)) + return 0; if (symtypes_file) { symfile = fopen(symtypes_file, "w"); diff --git a/scripts/gendwarfksyms/gendwarfksyms.h b/scripts/gendwarfksyms/gendwarfksyms.h index d9c06d2cb1df..32cec8f7695a 100644 --- a/scripts/gendwarfksyms/gendwarfksyms.h +++ b/scripts/gendwarfksyms/gendwarfksyms.h @@ -123,7 +123,7 @@ struct symbol { typedef void (*symbol_callback_t)(struct symbol *, void *arg); bool is_symbol_ptr(const char *name); -void symbol_read_exports(FILE *file); +int symbol_read_exports(FILE *file); void symbol_read_symtab(int fd); struct symbol *symbol_get(const char *name); void symbol_set_ptr(struct symbol *sym, Dwarf_Die *ptr); diff --git a/scripts/gendwarfksyms/symbols.c b/scripts/gendwarfksyms/symbols.c index 35ed594f0749..ecddcb5ffcdf 100644 --- a/scripts/gendwarfksyms/symbols.c +++ b/scripts/gendwarfksyms/symbols.c @@ -128,7 +128,7 @@ static bool is_exported(const char *name) return for_each(name, NULL, NULL) > 0; } -void symbol_read_exports(FILE *file) +int symbol_read_exports(FILE *file) { struct symbol *sym; char *line = NULL; @@ -159,6 +159,8 @@ void symbol_read_exports(FILE *file) free(line); debug("%d exported symbols", nsym); + + return nsym; } static void get_symbol(struct symbol *sym, void *arg) -- 2.51.2.1041.gc1ab5b90ca-goog
