Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bpf_pseudo_fd() type conversion error
With llvm15 and llvm16, the following command line sudo ./trace.py 'smp_call_function_single "%K", arg1' will cause error: /virtual/main.c:60:36: error: incompatible integer to pointer conversion passing 'u64' (aka 'unsigned long long') to parameter of type 'void *' [-Wint-conversion] bpf_perf_event_output(ctx, bpf_pseudo_fd(1, -1), CUR_CPU_IDENTIFIER, &__data, sizeof(__data)); ^~~~~~~~~~~~~~~~~~~~ 1 error generated. Failed to compile BPF module <text> In helpers.h, we have u64 bpf_pseudo_fd(u64, u64) asm("llvm.bpf.pseudo"); Apparently, <= llvm14 can tolerate u64 -> 'void *' conversion, but llvm15 by default will cause an error. Let us explicitly convert bpf_pseudo_fd to 'void *' to avoid such errors. Signed-off-by: Yonghong Song <[email protected]>
- Loading branch information