public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109068] New: bpf: "error: too many function arguments for eBPF" for always_inline function
@ 2023-03-08 19:40 david.faust at oracle dot com
2023-03-30 18:24 ` [Bug target/109068] " pinskia at gcc dot gnu.org
2023-08-15 12:48 ` jemarch at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: david.faust at oracle dot com @ 2023-03-08 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109068
Bug ID: 109068
Summary: bpf: "error: too many function arguments for eBPF" for
always_inline function
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: david.faust at oracle dot com
CC: cupertino.miranda at oracle dot com, jemarch at gcc dot gnu.org
Target Milestone: ---
Target: bpf
BPF calling convention does not support function calls with more than
5 arguments. But if the function is inlined this restriction should be
relaxed.
Many convenience macros for BPF in the kernel make use of always_inline
functions, and the expansion of the macro uses can result in an
always_inline function with >5 args. There are several examples of this
in the BPF selftests, so GCC fails to compile those tests.
e.g. on bpf-next:
linux/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c
and corresponding BPF_KSYSCALL macro def in
linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_tracing.h
duplicated from
linux/tools/lib/bpf/bpf_tracing.h
clang compiles these tests without issue.
We should fix the BPF backend check for function arguments to allow
calls to inline functions with >5 args.
$ cat args.c
inline __attribute__((always_inline))
int foo (int a, int b, int c, int d, int e, int f)
{
return a + b + c + d + e + f;
}
int bar (int x)
{
return foo (x, x*2, x*3, x*4, x*5, x*6);
}
$ bpf-unknown-none-gcc -c args.c -o args.o
args.c: In function ‘foo’:
args.c:2:5: error: too many function arguments for eBPF
2 | int foo (int a, int b, int c, int d, int e, int f)
| ^~~
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/109068] bpf: "error: too many function arguments for eBPF" for always_inline function
2023-03-08 19:40 [Bug target/109068] New: bpf: "error: too many function arguments for eBPF" for always_inline function david.faust at oracle dot com
@ 2023-03-30 18:24 ` pinskia at gcc dot gnu.org
2023-08-15 12:48 ` jemarch at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-30 18:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109068
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-03-30
Status|UNCONFIRMED |NEW
Keywords| |diagnostic
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/109068] bpf: "error: too many function arguments for eBPF" for always_inline function
2023-03-08 19:40 [Bug target/109068] New: bpf: "error: too many function arguments for eBPF" for always_inline function david.faust at oracle dot com
2023-03-30 18:24 ` [Bug target/109068] " pinskia at gcc dot gnu.org
@ 2023-08-15 12:48 ` jemarch at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jemarch at gcc dot gnu.org @ 2023-08-15 12:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109068
Jose E. Marchesi <jemarch at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
Fixed by:
commit 6103df1e4fae5192c507484b1d32f00c42c70b54
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date: Thu Aug 10 10:53:16 2023 +0200
bpf: allow exceeding max num of args in BPF when always_inline
BPF currently limits the number of registers used to pass arguments to
functions to five registers. There is a check for this at function
expansion time. However, if a function is guaranteed to be always
inlined (and its body never generated) by virtue of the always_inline
attribute, it can "receive" any number of arguments.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-15 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 19:40 [Bug target/109068] New: bpf: "error: too many function arguments for eBPF" for always_inline function david.faust at oracle dot com
2023-03-30 18:24 ` [Bug target/109068] " pinskia at gcc dot gnu.org
2023-08-15 12:48 ` jemarch at gcc dot gnu.org
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 read-only IMAP folder(s) and NNTP newsgroup(s).