Re: [PATCH 0/2] kbuild: link-vmlinux.sh: more reliable 3rd pass linking
From: Nathan Chancellor
Date: Fri Jul 31 2026 - 19:22:40 EST
Hi Andre,
> link-vmlinux.sh currently only uses the file size of
> .tmp_vmlinux?.kallsyms.o to determine if it needs to do a third pass. I
> was hitting a case where file size didn't change, but symbols changed
> sufficiently to still move subsequent symbols in vmlinux to invalidate
> kallsyms.
>
> In particular kallsyms_names grew by one byte between
> .tmp_vmlinux1.kallsyms.o and .tmp_vmlinux2.kallsyms.o, moving the next
> symbol to the next alignment offset (4 bytes), moving many subsequent
> symbols in the final vmlinux image in turn (until abosrbed by further
> alignment instructions). This failed the final link with:
>
> Inconsistent kallsyms data
> Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
>
> The two patches here are independent of each other:
> * Patch 2 in this series addresses the actual issue and also has a more
> detailed explanation with exact failure case
> * Patch 1 could be omitted if deemed useless, but I found it useful
> while debugging the issue. It just updates the kallsyms.c to instruct
> the assembler to also emit symbol sizes.
>
> Cheers,
> Andre'
>
> Signed-off-by: André Draszik <andre.draszik@xxxxxxxxxx>
> ---
> André Draszik (2):
> kallsyms: add symbol size for kallsyms symbols that can change size
> kbuild: link-vmlinux.sh: improve detection of third pass requirement
Thanks a lot for this series! This "Inconsistent kallsyms data" has been
plauging our continuous integration for quite a while but I could never
consistently reproduce the problem enough to actually investigate it. I
have run it through my full test matrix and not noticed any additional
problems. I will continue to hammer on it to see if this message ever
occurs again.
Tested-by: Nathan Chancellor <nathan@xxxxxxxxxx>
This should probably have some decent soak time in -next to make sure it
does not introduce any regressions. If we do not take it for 7.3 at this
point, I will make sure it gets applied as soon as 7.3-rc1 is out,
aiming to submit it for 7.4.
One note: the diff in the scissor area of second patch makes it fail to
apply.
--
Cheers,
Nathan