kallsyms: add symbol size for kallsyms symbols that can change size

Add symbol size for kallsyms symbols that can change size so that sizes
can be determined easily without having to manually calculate them
when inspecting the object files (.tmp_vmlinux?.kallsyms.o or
.tmp_vmlinux?). Without, the assembler records the symbol size as 0.

This is primarily useful as a debugging aid in case of linker errors as
part of link-vmlinux.sh, and because symbol size doesn't have to align
with the offset to the next symbol due to padding/alignment.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Signed-off-by: Nicolas Schier <nsc@kernel.org>
This commit is contained in:
André Draszik 2026-07-28 13:42:39 +01:00 committed by Nicolas Schier
parent 69ef27076d
commit d6bf11a7e8
No known key found for this signature in database
GPG Key ID: 07520A7016261269

View File

@ -398,11 +398,13 @@ static void write_src(void)
strcpy((char *)table[i]->sym, buf);
printf("\t/* %s */\n", table[i]->sym);
}
printf(".size kallsyms_names, . - kallsyms_names\n");
printf("\n");
output_label("kallsyms_markers");
for (i = 0; i < markers_cnt; i++)
printf("\t.long\t%u\n", markers[i]);
printf(".size kallsyms_markers, . - kallsyms_markers\n");
printf("\n");
free(markers);
@ -415,6 +417,7 @@ static void write_src(void)
printf("\t.asciz\t\"%s\"\n", buf);
off += strlen(buf) + 1;
}
printf(".size kallsyms_token_table, . - kallsyms_token_table\n");
printf("\n");
output_label("kallsyms_token_index");
@ -441,6 +444,7 @@ static void write_src(void)
(unsigned int)table[i]->addr, table[i]->sym);
}
}
printf(".size kallsyms_offsets, . - kallsyms_offsets\n");
printf("\n");
sort_symbols_by_name();