Re: [PATCH bpf-next 4/4] bpftool: use a local bpf_perf_event_value to fix accessing its fields

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

 



2023-05-12 14:59 UTC+0200 ~ Jiri Olsa <olsajiri@xxxxxxxxx>
> On Fri, May 12, 2023 at 11:33:54AM +0100, Quentin Monnet wrote:
>> From: Alexander Lobakin <alobakin@xxxxx>
>>
>> Fix the following error when building bpftool:
>>
>>   CLANG   profiler.bpf.o
>>   CLANG   pid_iter.bpf.o
>> skeleton/profiler.bpf.c:18:21: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_perf_event_value'
>>         __uint(value_size, sizeof(struct bpf_perf_event_value));
>>                            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:13:39: note: expanded from macro '__uint'
>> tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helper_defs.h:7:8: note: forward declaration of 'struct bpf_perf_event_value'
>> struct bpf_perf_event_value;
>>        ^
>>
>> struct bpf_perf_event_value is being used in the kernel only when
>> CONFIG_BPF_EVENTS is enabled, so it misses a BTF entry then.
> 
> hi,
> when I switch off CONFIG_BPF_EVENTS the bpftool build fails for me
> with missing BTF error:
> 
>   GEN     vmlinux.h
> libbpf: failed to find '.BTF' ELF section in /home/jolsa/kernel/linux-qemu/vmlinux
> Error: failed to load BTF from /home/jolsa/kernel/linux-qemu/vmlinux: No data available
> make: *** [Makefile:208: vmlinux.h] Error 195
> make: *** Deleting file 'vmlinux.h'
> 
> so I wonder you need to care about bpf_perf_event_value
> in that case
> 
> jirka

Thanks for testing, Jiri! As I understand, this is the vmlinux.h
generation failing, not the compilation from the updated skeletons, so
I'm not sure this is related to this patch, could be an existing bug.
Have you tried the same build without the patches, by any chance?

I'll try to reproduce on my side to try and figure out why libbpf's
bpf_parse_elf() fails to find the .BTF section.

Quentin





[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