linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* arm allmodconfig build issue with bpf
@ 2024-12-04 15:54 John Garry
  2024-12-04 16:06 ` Russell King (Oracle)
  0 siblings, 1 reply; 2+ messages in thread
From: John Garry @ 2024-12-04 15:54 UTC (permalink / raw)
  To: bpf, linux-arm-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: arm allmodconfig build issue with bpf
  2024-12-04 15:54 arm allmodconfig build issue with bpf John Garry
@ 2024-12-04 16:06 ` Russell King (Oracle)
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King (Oracle) @ 2024-12-04 16:06 UTC (permalink / raw)
  To: John Garry; +Cc: bpf, linux-arm-kernel

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.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-04 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04 15:54 arm allmodconfig build issue with bpf John Garry
2024-12-04 16:06 ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).