Message ID | 9950a25d-1a79-42c9-ade7-dc51ef569ad2@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | arm allmodconfig build issue with bpf | expand |
On Wed, Dec 04, 2024 at 03:54:30PM +0000, John Garry wrote: > 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 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587 seems relevant. Jakub's reply in comment 3 suggests that: #if __has_attribute(__retain__) && \ (defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || \ defined(CONFIG_LTO_CLANG)) # define __retain __attribute__((__retain__)) #else # define __retain #endif is wrong - __has_attribute(__retain__) doesn't mean that GCC supports __retain__, it only means that it "knows" about it but may still reject it. The nice thing about this bug is... it's remained "NEW" for three years already, so likely means that it remains unfixed.
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()