Re: Re: [PATCH] Fix 'libbpf: failed to find BTF info for global/extern symbol' since uninitialized global variables

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

 



On Sat, Oct 14, 2023 at 4:27 AM LiuLingze <luiyanbing@xxxxxxxxxxx> wrote:
>
> Hi Andrii Nakryiko,
>
> > On Fri, Oct 13, 2023 at 6:45=E2=80=AFAM LiuLingze <luiyanbing@xxxxxxxxxxx> =
> > wrote:
> > >
> > > ---
> > >  examples/c/usdt.bpf.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/examples/c/usdt.bpf.c b/examples/c/usdt.bpf.c
> > > index 49ba506..2612ec1 100644
> > > --- a/examples/c/usdt.bpf.c
> > > +++ b/examples/c/usdt.bpf.c
> > > @@ -5,7 +5,7 @@
> > >  #include <bpf/bpf_tracing.h>
> > >  #include <bpf/usdt.bpf.h>
> > >
> > > -pid_t my_pid;
> > > +pid_t my_pid =3D 0;
> >
> > This is effectively the same, my_pid will be initialized to zero
> > anyways. The difference might be due to you using too old Clang
> > version that might still be putting my_pid into a special COM section.
> >
> > Also "failed to find BTF info for global/extern symbol" is usually due
> > to too old Clang that doesn't emit BTF information for global
> > variables.
> >
> > So either way, can you try upgrading your Clang and see if the problem pers=
> > ists?
> >
> > >
> > >  SEC("usdt/libc.so.6:libc:setjmp")
> > >  int BPF_USDT(usdt_auto_attach, void *arg1, int arg2, void *arg3)
> > > --
> > > 2.37.2
> > >
> > >
> >
>
> Thank you for your reply.
>
> Yes, I was able to compile on a newer ubuntu with a higher version of clang.
>
> However, on a development module (nVidia Orin AGX) running an older version of ubuntu, it is not possible to use apt to update clang to a new version. Downloading the source code of a higher version of clang for compilation is cumbersome and affects compatibility. So I hope that with the above changes, the project code can be easily compiled and used in earlier versions.

Did you verify that specifically adding explicit `= 0` makes it more
compatible with old compiler or it's just a theory?

>
> Thanks,
> LiuLingze
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux