* [PATCH bpf-next v2] selftests/bpf: Remove unused arch macros in bpf_misc.h
@ 2026-12-03 12:21 Tiezhu Yang
2026-12-05 7:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2026-12-03 12:21 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Eduard Zingerman, Kumar Kartikeya Dwivedi
Cc: bpf, linux-kernel
The header progs/bpf_misc.h is only meant to be included by BPF programs
compiled for the BPF target, where architecture macros are not predefined
by the compiler.
Instead, the build system explicitly passes -D__TARGET_ARCH_$(SRCARCH) via
BPF_CFLAGS in Makefile.buildvars, where $(SRCARCH) is "x86" for 32-bit and
64-bit x86.
Remove all the unused compiler predefined architecture macros (including
the unreachable __i386__ check) from the FUNC_REG_ARG_CNT definitions in
progs/bpf_misc.h, keeping only __TARGET_ARCH_* to match the rest of the
file.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
v2: Rebase on the latest bpf-next tree since the uprobe_autoattach
fix series has been merged.
tools/testing/selftests/bpf/progs/bpf_misc.h | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index 2e1e09e966be..ab9ded6297f2 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -258,23 +258,21 @@
#endif
/* How many arguments are passed to function in register */
-#if defined(__TARGET_ARCH_x86) || defined(__x86_64__)
+#if defined(__TARGET_ARCH_x86)
#define FUNC_REG_ARG_CNT 6
-#elif defined(__i386__)
-#define FUNC_REG_ARG_CNT 3
-#elif defined(__TARGET_ARCH_s390) || defined(__s390x__)
+#elif defined(__TARGET_ARCH_s390)
#define FUNC_REG_ARG_CNT 5
-#elif defined(__TARGET_ARCH_arm) || defined(__arm__)
+#elif defined(__TARGET_ARCH_arm)
#define FUNC_REG_ARG_CNT 4
-#elif defined(__TARGET_ARCH_arm64) || defined(__aarch64__)
+#elif defined(__TARGET_ARCH_arm64)
#define FUNC_REG_ARG_CNT 8
-#elif defined(__TARGET_ARCH_mips) || defined(__mips__)
+#elif defined(__TARGET_ARCH_mips)
#define FUNC_REG_ARG_CNT 8
-#elif defined(__TARGET_ARCH_powerpc) || defined(__powerpc__) || defined(__powerpc64__)
+#elif defined(__TARGET_ARCH_powerpc)
#define FUNC_REG_ARG_CNT 8
-#elif defined(__TARGET_ARCH_sparc) || defined(__sparc__)
+#elif defined(__TARGET_ARCH_sparc)
#define FUNC_REG_ARG_CNT 6
-#elif defined(__TARGET_ARCH_riscv) || defined(__riscv__)
+#elif defined(__TARGET_ARCH_riscv)
#define FUNC_REG_ARG_CNT 8
#elif defined(__TARGET_ARCH_loongarch)
#define FUNC_REG_ARG_CNT 8
--
2.42.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH bpf-next v2] selftests/bpf: Remove unused arch macros in bpf_misc.h
2026-12-03 12:21 [PATCH bpf-next v2] selftests/bpf: Remove unused arch macros in bpf_misc.h Tiezhu Yang
@ 2026-12-05 7:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-05 7:20 UTC (permalink / raw)
To: Tiezhu Yang; +Cc: ast, daniel, andrii, eddyz87, memxor, bpf, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Thu, 3 Dec 2026 20:21:08 +0800 you wrote:
> The header progs/bpf_misc.h is only meant to be included by BPF programs
> compiled for the BPF target, where architecture macros are not predefined
> by the compiler.
>
> Instead, the build system explicitly passes -D__TARGET_ARCH_$(SRCARCH) via
> BPF_CFLAGS in Makefile.buildvars, where $(SRCARCH) is "x86" for 32-bit and
> 64-bit x86.
>
> [...]
Here is the summary with links:
- [bpf-next,v2] selftests/bpf: Remove unused arch macros in bpf_misc.h
https://git.kernel.org/bpf/bpf-next/c/653033585181
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-05 7:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 12:21 [PATCH bpf-next v2] selftests/bpf: Remove unused arch macros in bpf_misc.h Tiezhu Yang
2026-12-05 7:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox