Commit d9075ac6 authored by Cupertino Miranda's avatar Cupertino Miranda Committed by Andrii Nakryiko

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: default avatarCupertino Miranda <cupertino.miranda@oracle.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240819151129.1366484-4-cupertino.miranda@oracle.com
parent 2aa93695
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment