On Mon, Oct 26, 2020 at 03:18:22PM -0700, Hao Luo wrote: > Commit 2e719cc ("btf_encoder: revamp how per-CPU variables are > encoded") adds percpu_var_exists() to filter out the symbols that > are not percpu var. However, the check comes after checking the > var's type. There can be symbols that are of zero type. If we hit > that, btf_encoder will not work without '--btf_encode_force'. > So we should check percpu_var_exists before checking var's type. > > Tested: > haoluo@haoluo:~/kernel/tip$ gcc --version > gcc (GCC) 10.2.0 > Copyright (C) 2020 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > Before: > > haoluo@haoluo:~/kernel/tip$ make clean -s > haoluo@haoluo:~/kernel/tip$ make -j 32 -s > LINK resolve_btfids > error: found variable in CU 'kernel/bpf/btf.c' that has void type > Encountered error while encoding BTF. > FAILED: load BTF from vmlinux: Unknown error -2make: *** [Makefile:1164: vmlinux] Error 255 > > After: > > haoluo@haoluo:~/kernel/tip$ make clean -s > haoluo@haoluo:~/kernel/tip$ make -j 32 -s > LINK resolve_btfids > haoluo@haoluo:~/kernel/tip$ > > Fixes: 2e719cc ("btf_encoder: revamp how per-CPU variables are encoded") > Signed-off-by: Hao Luo <haoluo@xxxxxxxxxx> it fixes the build issue for me Tested-by: Jiri Olsa <jolsa@xxxxxxxxxx> thanks, jirka