Re: [PATCH v2 11/18] perf symbol-elf: Cache ELF program/section headers and defer symbol name lookup
From: Alireza Haghdoost
Date: Fri Oct 30 2026 - 09:35:57 EST
On Tue, Oct 27, 2026 at 4:15 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> + /*
> + * For misannotated, zeroed, ASM function sizes.
> + */
> + if (nr > 0) {
> + struct kmap *kmap = dso__kernel(dso) ? map__kmap(map) : NULL;
> + struct maps *kmaps = kmap ? map__kmaps(map) : NULL;
> +
> + symbols__fixup_end(dso__symbols(dso), false);
> + symbols__fixup_duplicate(dso__symbols(dso));
Could the change to run these fixups once per load be split into its
own patch, with an explanation and a test? It changes symbol
resolution, not only the amount of work.
Before this change, a zero-size .symtab symbol ended at the next
.symtab symbol, so it could cover a function that only exists in
.dynsym. Running the fixups after both tables have loaded instead ends
it at the next symbol from either table.
I reproduced this with a small library where zfun has no .size. The
next function in address order is efun, which I removed from .symtab
with objcopy --strip-symbol=efun but left exported in .dynsym. The
same sample is then attributed differently:
before: 99.97% libz.so [.] zfun
after: 99.97% libz.so [.] efun
The new answer looks right to me. Minidebuginfo, where exports may
exist only in .dynsym, should hit the same pattern and would be useful
test coverage for the separate patch.
Thanks,
Alireza