Re: [PATCH 1/2] kallsyms: add symbol size for kallsyms symbols that can change size

Geert Uytterhoeven <[email protected]>
Newsgroups gmane.linux.kbuild.devel,gmane.linux.kernel
Message-ID <CAMuHMdX=1ZPjBHh7bQyC_EEU47vLERf24U7vc9u5PgGZ4D8ULQ@mail.gmail.com>
Hi André,

On Mon, 24 Aug 2026 at 15:35, André Draszik <[email protected]> wrote:
> On Mon, 2026-08-24 at 14:26 +0200, Geert Uytterhoeven wrote:
> > On Tue, 28 Jul 2026 at 14:52, André Draszik <[email protected]> wrote:
> > > 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 <[email protected]>
> >
> > Thanks for your patch, which is now commit d6bf11a7e8a86135 ("kallsyms:
> > add symbol size for kallsyms symbols that can change size") upstream.
> >
> > FTR, this commit has a huge impact on kernel size, according to
> > bloat-o-meter:
> >
> >     $ bloat-o-meter vmlinux.{old,}
> >     add/remove: 4/0 grow/shrink: 0/0 up/down: 440264/0 (440264)
> >     Function                                     old     new   delta
> >     kallsyms_names                                 -  324543 +324543
> >     kallsyms_offsets                               -  114424 +114424
> >     kallsyms_token_table                           -     849    +849
> >     kallsyms_markers                               -     448    +448
> >     Total: Before=5085496, After=5525760, chg +8.66%
>
> I suppose the reason is that before the patch each of the above 4
> symbols' size was recorded as 0 in the ELF file by the assembler.
>
> With this patch, the assembler places the actual size for each
> symbol. Hence they appear to have grown, but in reality they
> haven't.
>
> Looking at the delta between each of the symbol's start address with
> and without the patch should confirm that, too.

Correct:

$ diff <(nm -S vmlinux.old | sort ) <(nm -S vmlinux | sort)
--- /dev/fd/63 2026-08-24 15:46:29.404049009 +0200
+++ /dev/fd/62 2026-08-24 15:46:29.404049009 +0200
@@ -34748,11 +34748,11 @@
 0045884a 000000c8 d decpair
 00458912 000000c7 D linux_banner
 004589dc D kallsyms_num_syms
-004589e0 D kallsyms_names
-004a7da0 D kallsyms_markers
-004a7f60 D kallsyms_token_table
+004589e0 0004f3bf D kallsyms_names
+004a7da0 000001c0 D kallsyms_markers
+004a7f60 00000351 D kallsyms_token_table
 004a82b4 D kallsyms_token_index
-004a84b4 D kallsyms_offsets
+004a84b4 0001bef8 D kallsyms_offsets
 004c43ac D kallsyms_seqs_of_names
 00520100 00000070 D stop_sched_class
 00520100 D __sched_class_highest

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.