tools/bpf: build failed with defconfig(x86_64) on v5.6 and v5.7

From: Li Xinhai
Date: Wed Jun 24 2020 - 02:45:36 EST


- information of machine
Linux localhost.localdomain 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

- configurations
make defconfig
make kvmconfig

- failed logs on v5.6
```
 LINK   /mnt/build/1_build/05_build_v5.6/bpf/bpftool//libbpf/libbpf.a
 LINK   /mnt/build/1_build/05_build_v5.6/bpf/bpftool/bpftool
 DESCEND Ârunqslower
 GEN   Â/mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/bpf_helper_defs.h
make[4]: *** No rule to make target '/mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h', needed by '/mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/staticobjs/libbpf.o'. ÂStop.
make[3]: *** [Makefile:183: /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/staticobjs/libbpf-in.o] Error 2
make[2]: *** [Makefile:79: .output/libbpf.a] Error 2
make[1]: *** [Makefile:119: runqslower] Error 2
make: *** [Makefile:68: bpf] Error 2
```

- failed logs on v5.7
```
In file included from /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:5,
        Âfrom /mnt/build/0_code/0_linux/linux/tools/include/linux/kernel.h:8,
        Âfrom /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.h:10,
        Âfrom /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c:8:
/mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c: In function â__func_get_nameâ:
/mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:37:38: warning: nested extern declaration of â__compiletime_assert_0â [-Wnested-externs]
 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                   ^~~~~~~~~~~~~~~~~~~~~
/mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:16:15: note: in definition of macro â__compiletime_assertâ
 Âextern void prefix ## suffix(void) __compiletime_error(msg); \
       Â^~~~~~
/mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:37:2: note: in expansion of macro â_compiletime_assertâ
 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
 ^~~~~~~~~~~~~~~~~~~
/mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:39:37: note: in expansion of macro âcompiletime_assertâ
Â#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                  Â^~~~~~~~~~~~~~~~~~
/mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:50:2: note: in expansion of macro âBUILD_BUG_ON_MSGâ
 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 ^~~~~~~~~~~~~~~~
/mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c:20:2: note: in expansion of macro âBUILD_BUG_ONâ
 BUILD_BUG_ON(ARRAY_SIZE(func_id_str) != __BPF_FUNC_MAX_ID);
 ^~~~~~~~~~~~
```

andÂ
```
 LINK   /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/libbpf.a
 GEN   Âvmlinux.h
 BPF   Ârunqslower.bpf.o
In file included from runqslower.bpf.c:3:
.output/vmlinux.h:5:15: error: attribute 'preserve_access_index' is not supported by '#pragma clang attribute'
#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)
       ^
.output/vmlinux.h:98607:15: error: '#pragma clang attribute pop' with no matching '#pragma clang attribute push'
#pragma clang attribute pop
       ^
2 errors generated.
make[2]: *** [Makefile:57: .output/runqslower.bpf.o] Error 1
make[1]: *** [Makefile:119: runqslower] Error 2
make: *** [Makefile:68: bpf] Error 2
```

On this same machine and with same configuration, I've tried v5.4 and v5.5, no failures.