Re: [PATCH v4 03/19] gendwarfksyms: Add address matching
From: Sami Tolvanen
Date: Thu Oct 17 2024 - 13:17:28 EST
Hi,
On Thu, Oct 17, 2024 at 7:08 AM Petr Pavlu <petr.pavlu@xxxxxxxx> wrote:
>
> > @@ -22,9 +53,13 @@ static unsigned int for_each(const char *name, symbol_callback_t func,
> > if (strcmp(match->name, name))
> > continue;
> >
> > + /* Call func for the match, and all address matches */
> > if (func)
> > func(match, data);
> >
> > + if (match->addr.section != SHN_UNDEF)
> > + return __for_each_addr(match, func, data) + 1;
> > +
> > return 1;
> > }
>
> This change means that symbol_get() doesn't return the first matching
> symbol but the last one matched by an address.
>
> For instance:
> void foo(int a1) {}
> void bar(int a1) __attribute__((alias("foo")));
>
> The compiler produces the debug information only for foo() but
> gendwarfksyms would instead report that it processed bar() when reading
> this data, which is misleading. On the other hand, I don't immediately
> see that it would result in an incorrect CRC or symtypes output, because
> the symbols with the same address are effectively treated as one group,
> so I'm not sure if this is important or not.
Hmm, I suppose we could print out all the symbol names that matched,
but no, this doesn't affect versions or type output. I'll think about
it.
Sami