Hi all,
For some time, the arm allmodconfig build has had this following build
issue for me:
$ make net/bpf/test_run.o
CALL scripts/checksyscalls.sh
CC net/bpf/test_run.o
net/bpf/test_run.c:522:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
522 | {
| ^
net/bpf/test_run.c:568:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
568 | {
| ^
net/bpf/test_run.c:577:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
577 | {
| ^
net/bpf/test_run.c:584:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
584 | {
| ^
net/bpf/test_run.c:590:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
590 | {
| ^
net/bpf/test_run.c:619:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
619 | {
| ^
net/bpf/test_run.c:624:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
624 | {
| ^
net/bpf/test_run.c:630:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
630 | {
| ^
net/bpf/test_run.c:634:1: error: ‘retain’ attribute ignored
[-Werror=attributes]
634 | {
| ^
cc1: all warnings being treated as errors
make[4]: *** [scripts/Makefile.build:194: net/bpf/test_run.o] Error 1
make[3]: *** [scripts/Makefile.build:440: net/bpf] Error 2
make[2]: *** [scripts/Makefile.build:440: net] Error 2
make[1]: *** [/home/ubuntu/mnt/linux2/Makefile:1989: .] Error 2
make: *** [Makefile:251: __sub-make] Error 2
ubuntu@jgarry-ubuntu-bm5-instance-20230215-1843:~/mnt/linux2$
The issue comes the definition of __bpf_kfunc from include/linux/btf.h
Other files which include btf.h, like kernel/cgroup/rstat.c, have this
same issue.
I am crossing compiling with the following:
$ /usr/bin/arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 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.
Normally I bodge a fix like:
---->8----
diff --git a/include/linux/btf.h b/include/linux/btf.h
index b12c63af9e78..4214e76c9168 100644
--- a/include/linux/btf.h
+++ b/include/linux/btf.h
@@ -83,7 +83,7 @@
* as to avoid issues such as the compiler inlining or eliding either
a static
* kfunc, or a global kfunc in an LTO build.
*/
-#define __bpf_kfunc
+#define __bpf_kfunc __used __retain noinline
#define __bpf_kfunc_start_defs()
\
__diag_push();
----8<----
Any proposals to properly fix this?
Thanks,
John