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 Fri, Oct 13, 2023 at 6:45 AM 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 = 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 persists?

>
>  SEC("usdt/libc.so.6:libc:setjmp")
>  int BPF_USDT(usdt_auto_attach, void *arg1, int arg2, void *arg3)
> --
> 2.37.2
>
>





[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