* [PATCH bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM
@ 2025-03-10 14:51 Anton Protopopov
2025-03-10 16:41 ` Daniel Xu
2025-03-10 22:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Anton Protopopov @ 2025-03-10 14:51 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Daniel Xu, bpf
Cc: Anton Protopopov
The Makefile uses the exit code of the `llvm-config --link-static --libs`
command to choose between statically-linked and dynamically-linked LLVMs.
The stdout and stderr of that command are redirected to /dev/null.
To redirect the output the "&>" construction is used, which might not be
supported by /bin/sh, which is executed by make for $(shell ...) commands.
On such systems the test will fail even if static LLVM is actually
supported. Replace "&>" by ">/dev/null 2>&1" to fix this.
Fixes: 2a9d30fac818 ("selftests/bpf: Support dynamically linking LLVM if static is not available")
Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
---
tools/testing/selftests/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 739305064839..ca41d47d4ba6 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -180,7 +180,7 @@ ifeq ($(feature-llvm),1)
# both llvm-config and lib.mk add -D_GNU_SOURCE, which ends up as conflict
LLVM_CFLAGS += $(filter-out -D_GNU_SOURCE,$(shell $(LLVM_CONFIG) --cflags))
# Prefer linking statically if it's available, otherwise fallback to shared
- ifeq ($(shell $(LLVM_CONFIG) --link-static --libs &> /dev/null && echo static),static)
+ ifeq ($(shell $(LLVM_CONFIG) --link-static --libs >/dev/null 2>&1 && echo static),static)
LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --libs $(LLVM_CONFIG_LIB_COMPONENTS))
LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
LLVM_LDLIBS += -lstdc++
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM
2025-03-10 14:51 [PATCH bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM Anton Protopopov
@ 2025-03-10 16:41 ` Daniel Xu
2025-03-10 22:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Xu @ 2025-03-10 16:41 UTC (permalink / raw)
To: Anton Protopopov
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, bpf
On Mon, Mar 10, 2025 at 02:51:12PM +0000, Anton Protopopov wrote:
> The Makefile uses the exit code of the `llvm-config --link-static --libs`
> command to choose between statically-linked and dynamically-linked LLVMs.
> The stdout and stderr of that command are redirected to /dev/null.
> To redirect the output the "&>" construction is used, which might not be
> supported by /bin/sh, which is executed by make for $(shell ...) commands.
> On such systems the test will fail even if static LLVM is actually
> supported. Replace "&>" by ">/dev/null 2>&1" to fix this.
>
> Fixes: 2a9d30fac818 ("selftests/bpf: Support dynamically linking LLVM if static is not available")
> Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
> ---
> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 739305064839..ca41d47d4ba6 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -180,7 +180,7 @@ ifeq ($(feature-llvm),1)
> # both llvm-config and lib.mk add -D_GNU_SOURCE, which ends up as conflict
> LLVM_CFLAGS += $(filter-out -D_GNU_SOURCE,$(shell $(LLVM_CONFIG) --cflags))
> # Prefer linking statically if it's available, otherwise fallback to shared
> - ifeq ($(shell $(LLVM_CONFIG) --link-static --libs &> /dev/null && echo static),static)
> + ifeq ($(shell $(LLVM_CONFIG) --link-static --libs >/dev/null 2>&1 && echo static),static)
> LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --libs $(LLVM_CONFIG_LIB_COMPONENTS))
> LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
> LLVM_LDLIBS += -lstdc++
> --
> 2.34.1
>
Acked-by: Daniel Xu <dxu@dxuuu.xyz>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM
2025-03-10 14:51 [PATCH bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM Anton Protopopov
2025-03-10 16:41 ` Daniel Xu
@ 2025-03-10 22:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-10 22:20 UTC (permalink / raw)
To: Anton Protopopov
Cc: andrii, eddyz87, mykolal, ast, daniel, martin.lau, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa, dxu,
bpf
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Mon, 10 Mar 2025 14:51:12 +0000 you wrote:
> The Makefile uses the exit code of the `llvm-config --link-static --libs`
> command to choose between statically-linked and dynamically-linked LLVMs.
> The stdout and stderr of that command are redirected to /dev/null.
> To redirect the output the "&>" construction is used, which might not be
> supported by /bin/sh, which is executed by make for $(shell ...) commands.
> On such systems the test will fail even if static LLVM is actually
> supported. Replace "&>" by ">/dev/null 2>&1" to fix this.
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM
https://git.kernel.org/bpf/bpf-next/c/74f36a97e5e5
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] 3+ messages in thread
end of thread, other threads:[~2025-03-10 22:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 14:51 [PATCH bpf-next] selftests/bpf: fix selection of static vs. dynamic LLVM Anton Protopopov
2025-03-10 16:41 ` Daniel Xu
2025-03-10 22: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