Skip to content

Commit 82cea43

Browse files
GorilaMondanakryiko
authored andcommitted
examples/c/usdt: fix a compilation error
Fix 'libbpf: failed to find BTF info for global/extern symbol' erro due to an uninitialized global variables, which causes problems on Ubuntu 20.04.6 with clang 10. I was able to compile on a newer ubuntu with a newer version of clang. However, on a development module (nVidia Orin AGX) running Ubuntu 20.04.6 LTS with clang version 10.0.0-4ubuntu1, 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. So I hope that with the change, the project code can be easily compiled and used in earlier os. Signed-off-by: Liu Lingze <luiyanbing@foxmail.com>
1 parent 25b7e7b commit 82cea43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/c/usdt.bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <bpf/bpf_tracing.h>
66
#include <bpf/usdt.bpf.h>
77

8-
pid_t my_pid;
8+
pid_t my_pid = 0;
99

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

0 commit comments

Comments
 (0)