selftests/bpf: fix bpf_target_sparc check
Subsystems (5)
PATCH 1/1 selftests/bpf: fix bpf_target_sparc check
bpf_helpers.h fails to compile on sparc: the code should be checking for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.
--- tools/testing/selftests/bpf/bpf_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_helpers.h +1 -1
@@ -443,7 +443,7 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,#ifdef bpf_target_powerpc#define BPF_KPROBE_READ_RET_IP (ip, ctx) ({ (ip) = (ctx)->link; })#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP -#elif bpf_target_sparc +#elif defined(bpf_target_sparc)#define BPF_KPROBE_READ_RET_IP (ip, ctx) ({ (ip) = PT_REGS_RET(ctx); })#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP#else
Signature · 1 line
2.21.0
Quoted 14 lines · Ilya Leoshkevich
bpf_helpers.hfails to compile on sparc: the code should be checking fordefined(bpf_target_sparc), but checks simply forbpf_target_sparc.Signed-off-by Ilya Leoshkevich <[email protected]>--- tools/testing/selftests/bpf/bpf_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/bpf/bpf_helpers.h +0
-0
tools/testing/selftests/bpf/bpf_helpers.h static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode, · line 443
Quoted 1 line
tools/testing/selftests/bpf/bpf_helpers.h +0
-0@@ -443,7 +443,7 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,#ifdef bpf_target_powerpc
While at it, can you please also fix this one?
Quoted 10 lines
tools/testing/selftests/bpf/bpf_helpers.h +1
-2#define BPF_KPROBE_READ_RET_IP (ip, ctx) ({ (ip) = (ctx)->link; })#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP -#elif bpf_target_sparc +#elif defined(bpf_target_sparc)#define BPF_KPROBE_READ_RET_IP (ip, ctx) ({ (ip) = PT_REGS_RET(ctx); })#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP#else --2.21.0
Quoted 12 lines
Am 09.07.2019 um 19:56 schrieb Andrii Nakryiko <[email protected]>:
Quoted 9 lines · Ilya Leoshkevich
bpf_helpers.hfails to compile on sparc: the code should be checking fordefined(bpf_target_sparc), but checks simply forbpf_target_sparc.Signed-off-by Ilya Leoshkevich <[email protected]>---
tools/testing/selftests/bpf/bpf_helpers.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
tools/testing/selftests/bpf/bpf_helpers.h static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode, · line 443
Quoted 6 lines
tools/testing/selftests/bpf/bpf_helpers.h +0
-0@@ -443,7 +443,7 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,#ifdef bpf_target_powerpcWhile at it, can you please also fix this one?
Do you mean #ifdef bpf_target_powerpc? I think it’s correct, because it’s #ifdef, not #if. But I could change it to #if defined() for consistency.
Best regards,
Ilya