* [selftests/bpf QUESTION] What is the proper way to fix the build error
@ 2025-10-17 10:05 Tiezhu Yang
2025-10-17 15:21 ` Yonghong Song
0 siblings, 1 reply; 4+ messages in thread
From: Tiezhu Yang @ 2025-10-17 10:05 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman; +Cc: bpf, linux-kernel
Hi,
When compiling tools/testing/selftests/bpf, there is a build error:
CLNG-BPF [test_progs] verifier_global_ptr_args.bpf.o
progs/verifier_global_ptr_args.c:228:5: error: redefinition of 'off' as
different kind of symbol
228 | u32 off;
| ^
/home/fedora/newfixbpf.git/tools/testing/selftests/bpf/tools/include/vmlinux.h:21409:2:
note: previous definition is here
21409 | off = 0,
| ^
1 error generated.
tools/testing/selftests/bpf/tools/include/vmlinux.h:21409
enum i40e_ptp_gpio_pin_state {
end = -2,
invalid = -1,
off = 0,
in_A = 1,
in_B = 2,
out_A = 3,
out_B = 4,
};
The previous definition of "off" is in
drivers/net/ethernet/intel/i40e/i40e_ptp.c:
enum i40e_ptp_gpio_pin_state {
end = -2,
invalid,
off,
in_A,
in_B,
out_A,
out_B,
};
CONFIG_I40E is set in the defconfig file to build i40e_ptp.c after the
commit 032676ff8217 (LoongArch: Update Loongson-3 default config file)
in 6.18-rc1.
What is the proper way to fix the build error?
(1) just disable CONFIG_I40E (CONFIG_I40E=n), then no "off" in vmlinux.h
(2) set it as a module (CONFIG_I40E=m), then no "off" in vmlinux.h
(3) modify the variable name "off" in verifier_global_ptr_args.c
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [selftests/bpf QUESTION] What is the proper way to fix the build error
2025-10-17 10:05 [selftests/bpf QUESTION] What is the proper way to fix the build error Tiezhu Yang
@ 2025-10-17 15:21 ` Yonghong Song
2025-10-17 15:54 ` [PATCH] selftests/bpf: Fix redefinition of 'off' as different kind of symbol Brahmajit Das
0 siblings, 1 reply; 4+ messages in thread
From: Yonghong Song @ 2025-10-17 15:21 UTC (permalink / raw)
To: Tiezhu Yang, Andrii Nakryiko, Eduard Zingerman; +Cc: bpf, linux-kernel
On 10/17/25 3:05 AM, Tiezhu Yang wrote:
> Hi,
>
> When compiling tools/testing/selftests/bpf, there is a build error:
>
> CLNG-BPF [test_progs] verifier_global_ptr_args.bpf.o
> progs/verifier_global_ptr_args.c:228:5: error: redefinition of 'off'
> as different kind of symbol
> 228 | u32 off;
> | ^
> /home/fedora/newfixbpf.git/tools/testing/selftests/bpf/tools/include/vmlinux.h:21409:2:
> note: previous definition is here
> 21409 | off = 0,
> | ^
> 1 error generated.
>
> tools/testing/selftests/bpf/tools/include/vmlinux.h:21409
>
> enum i40e_ptp_gpio_pin_state {
> end = -2,
> invalid = -1,
> off = 0,
> in_A = 1,
> in_B = 2,
> out_A = 3,
> out_B = 4,
> };
>
> The previous definition of "off" is in
> drivers/net/ethernet/intel/i40e/i40e_ptp.c:
>
> enum i40e_ptp_gpio_pin_state {
> end = -2,
> invalid,
> off,
> in_A,
> in_B,
> out_A,
> out_B,
> };
>
> CONFIG_I40E is set in the defconfig file to build i40e_ptp.c after the
> commit 032676ff8217 (LoongArch: Update Loongson-3 default config file)
> in 6.18-rc1.
>
> What is the proper way to fix the build error?
> (1) just disable CONFIG_I40E (CONFIG_I40E=n), then no "off" in vmlinux.h
> (2) set it as a module (CONFIG_I40E=m), then no "off" in vmlinux.h
> (3) modify the variable name "off" in verifier_global_ptr_args.c
I would recommend to rename 'off' in verifier_global_ptr_args.c to 'offset'.
>
> Thanks,
> Tiezhu
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] selftests/bpf: Fix redefinition of 'off' as different kind of symbol
2025-10-17 15:21 ` Yonghong Song
@ 2025-10-17 15:54 ` Brahmajit Das
2025-10-17 16:41 ` Yonghong Song
0 siblings, 1 reply; 4+ messages in thread
From: Brahmajit Das @ 2025-10-17 15:54 UTC (permalink / raw)
To: yonghong.song; +Cc: andrii, bpf, eddyz87, linux-kernel, yangtiezhu
This fixes the following build error
CLNG-BPF [test_progs] verifier_global_ptr_args.bpf.o
progs/verifier_global_ptr_args.c:228:5: error: redefinition of 'off' as
different kind of symbol
228 | u32 off;
| ^
Suggested-by: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Brahmajit Das <listout@listout.xyz>
---
Please refer: https://lore.kernel.org/bpf/5ca1d6a6-5e5a-3485-d3cd-f9439612d1f3@loongson.cn/
---
.../selftests/bpf/progs/verifier_global_ptr_args.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
index 6630a92b1b47..1204fbc58178 100644
--- a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
+++ b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
@@ -225,7 +225,7 @@ int trusted_to_untrusted(void *ctx)
}
char mem[16];
-u32 off;
+u32 offset;
SEC("tp_btf/sys_enter")
__success
@@ -240,9 +240,9 @@ int anything_to_untrusted(void *ctx)
/* scalar to untrusted */
subprog_untrusted(0);
/* variable offset to untrusted (map) */
- subprog_untrusted((void *)mem + off);
+ subprog_untrusted((void *)mem + offset);
/* variable offset to untrusted (trusted) */
- subprog_untrusted((void *)bpf_get_current_task_btf() + off);
+ subprog_untrusted((void *)bpf_get_current_task_btf() + offset);
return 0;
}
@@ -298,12 +298,12 @@ int anything_to_untrusted_mem(void *ctx)
/* scalar to untrusted mem */
subprog_void_untrusted(0);
/* variable offset to untrusted mem (map) */
- subprog_void_untrusted((void *)mem + off);
+ subprog_void_untrusted((void *)mem + offset);
/* variable offset to untrusted mem (trusted) */
- subprog_void_untrusted(bpf_get_current_task_btf() + off);
+ subprog_void_untrusted(bpf_get_current_task_btf() + offset);
/* variable offset to untrusted char/enum (map) */
- subprog_char_untrusted(mem + off);
- subprog_enum_untrusted((void *)mem + off);
+ subprog_char_untrusted(mem + offset);
+ subprog_enum_untrusted((void *)mem + offset);
return 0;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/bpf: Fix redefinition of 'off' as different kind of symbol
2025-10-17 15:54 ` [PATCH] selftests/bpf: Fix redefinition of 'off' as different kind of symbol Brahmajit Das
@ 2025-10-17 16:41 ` Yonghong Song
0 siblings, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2025-10-17 16:41 UTC (permalink / raw)
To: Brahmajit Das; +Cc: andrii, bpf, eddyz87, linux-kernel, yangtiezhu
On 10/17/25 8:54 AM, Brahmajit Das wrote:
> This fixes the following build error
>
> CLNG-BPF [test_progs] verifier_global_ptr_args.bpf.o
> progs/verifier_global_ptr_args.c:228:5: error: redefinition of 'off' as
> different kind of symbol
> 228 | u32 off;
> | ^
>
> Suggested-by: Yonghong Song <yonghong.song@linux.dev>
> Signed-off-by: Brahmajit Das <listout@listout.xyz>
Please add more context in the commit message about where the
redefinition of 'off' comes from.
Also, please replace [PATCH] to [PATCH bpf] so CI can do proper testing.
So in the next revision you can have [PATCH bpf v2].
With the changes in the above, you can carry my ack.
Acked-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> Please refer: https://lore.kernel.org/bpf/5ca1d6a6-5e5a-3485-d3cd-f9439612d1f3@loongson.cn/
> ---
> .../selftests/bpf/progs/verifier_global_ptr_args.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
> index 6630a92b1b47..1204fbc58178 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
> @@ -225,7 +225,7 @@ int trusted_to_untrusted(void *ctx)
> }
>
> char mem[16];
> -u32 off;
> +u32 offset;
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-17 16:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 10:05 [selftests/bpf QUESTION] What is the proper way to fix the build error Tiezhu Yang
2025-10-17 15:21 ` Yonghong Song
2025-10-17 15:54 ` [PATCH] selftests/bpf: Fix redefinition of 'off' as different kind of symbol Brahmajit Das
2025-10-17 16:41 ` Yonghong Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox