mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
selftest/bpf: Adapt inline asm operand constraint for GCC support
GCC errors when compiling tailcall_bpf2bpf_hierarchy2.c and
tailcall_bpf2bpf_hierarchy3.c with the following error:
progs/tailcall_bpf2bpf_hierarchy2.c: In function 'tailcall_bpf2bpf_hierarchy_2':
progs/tailcall_bpf2bpf_hierarchy2.c:66:9: error: input operand constraint contains '+'
66 | asm volatile (""::"r+"(ret));
| ^~~
Changed implementation to make use of __sink macro that abstracts the
desired behaviour.
The proposed change seems valid for both GCC and CLANG.
Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240819151129.1366484-4-cupertino.miranda@oracle.com
This commit is contained in:
parent
2aa9369508
commit
d9075ac631
|
|
@ -58,12 +58,12 @@ __retval(33)
|
|||
SEC("tc")
|
||||
int tailcall_bpf2bpf_hierarchy_2(struct __sk_buff *skb)
|
||||
{
|
||||
volatile int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
subprog_tail0(skb);
|
||||
subprog_tail1(skb);
|
||||
|
||||
asm volatile (""::"r+"(ret));
|
||||
__sink(ret);
|
||||
return (count1 << 16) | count0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ __retval(33)
|
|||
SEC("tc")
|
||||
int tailcall_bpf2bpf_hierarchy_3(struct __sk_buff *skb)
|
||||
{
|
||||
volatile int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
bpf_tail_call_static(skb, &jmp_table0, 0);
|
||||
|
||||
asm volatile (""::"r+"(ret));
|
||||
__sink(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user