Re: [PATCH 0/1] btf_loader support for subprogram linkage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 26, 2024 at 10:58 AM Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
>
> On Mon, Aug 26, 2024 at 11:53:56AM -0300, Arnaldo Carvalho de Melo wrote:
> > On Mon, Aug 26, 2024 at 11:52:13AM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Fri, Aug 23, 2024 at 05:28:30PM -0400, Will Hawkins wrote:
> > > > First,
> > > >
> > > > I am a huge fan of pahole (and friends). I volunteered to work on
> > > > helping to edit the BTF spec for the IETF and so I've started to look
> > > > more deeply at BTF and the tools.
> > > >
> > > > Second, I hope that what I am offering is being sent to the right place
> > > > and is in the right format. I tried to follow what seems to be the
> > > > "right thing" by looking at mailing list archives.
> > > >
> > > > This patch add supports to the btf_loader for subprogram (BTF_KIND_FUNC)
> > > > linkages. For example,
> > > >
> > > > ```
> > > > $ cat a.c
> > > > static int x() {
> > > >   return 5;
> > > > }
> > > > $ gcc -gbtf -g -O0 -c a.c
> > > > $ ~/code/pahole/build/pfunct -Fbtf --compile a.o
> > > > int x(void) /* linkage=static */
> > > > {
> > > >   return 0;
> > > > }
> > > > ```
> > >
> > > So, I'm changing this to become:
> > >
> > >   $ ~/code/pahole/build/pfunct -Fbtf --compile a.o
> > >   static int x(void)
> > >   {
> > >     return 0;
> > >   }
> > >
> > > As --compile is supposed to generate compileable code that is as much as
> > > possible from the type information similar to the original code, ok?
> >
> > I see, your patch isn't the one adding that linkage comment, you're just
> > collecting it from BTF, I'll then add a followup patch to get to the
> > output I described.
>
> So I'll looked up what that linkage field comes from and:
>
> commit ce516fb0cf2a3d9fc45c2a9c7ab2cf4bd24965a0
> Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
> Date:   Sun Jul 8 19:47:26 2007 -0300
>
>     [LIB]: Support DW_AT_MIPS_linkage_name
>
>     Another C++ specific case:
>
>     -       class TypeTemplate ByName(const string  &, size_t);
>     +       class TypeTemplate ByName(const string  &, size_t); /* linkage=_ZN4ROOT6Reflex12TypeTemplate6ByNameERKSsj */
>
>     Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
>
> So its not really "static" or "stern", but the mangled name in languages
> such as C++, so I think this patch needs reworking, there is ambiguity
> on the "linkage" term, we should use some other term :-\

Completely understand! I will rework it and propose something different.

I am just thankful that you are so welcoming of the contribution! Your
enthusiasm has made a contributor for life!

Will


>
> - Arnaldo





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux