Re: [PATCH 0/2] kbuild: link-vmlinux.sh: more reliable 3rd pass linking

Nathan Chancellor <[email protected]> Fri, 31 Jul 2026 16:22:17 -0700
Newsgroups dev.linux.lists.llvm,org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel
Message-ID <178554013759.3652505.7898833065785451675.b4-review@b4>
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 <[email protected]>
> ---
> 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 <[email protected]>

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