]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool/klp: Create empty checksum sections for function-less object files
authorJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 31 Mar 2026 04:50:46 +0000 (21:50 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:16:04 +0000 (21:16 -0700)
If an object file has no functions, objtool has nothing to checksum, so
it doesn't create the .discard.sym_checksum symbol.

Then when 'objtool klp diff' reads symbol checksums, it errors out due
to the missing .discard.sym_checksum section.

Instead, just create an empty checksum section to signal to
read_sym_checksums() that the file has been processed.

Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/check.c

index e7579c4e46dcaa0306d138ced312eca25811d433..f020f21f94a7635bf9e24f1ca7c130a7efc894b3 100644 (file)
@@ -1044,9 +1044,6 @@ static int create_sym_checksum_section(struct objtool_file *file)
                if (sym->csum.checksum)
                        idx++;
 
-       if (!idx)
-               return 0;
-
        sec = elf_create_section_pair(file->elf, ".discard.sym_checksum", entsize,
                                      idx, idx);
        if (!sec)