Commit 88e85a7d authored by Masahiro Yamada's avatar Masahiro Yamada Committed by David S. Miller

bpfilter: check compiler capability in Kconfig

With the brand-new syntax extension of Kconfig, we can directly
check the compiler capability in the configuration phase.

If the cc-can-link.sh fails, the BPFILTER_UMH is automatically
hidden by the dependency.

I also deleted 'default n', which is no-op.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82be2ab1
...@@ -507,11 +507,6 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLA ...@@ -507,11 +507,6 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLA
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
endif endif
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/cc-can-link.sh $(CC)), y)
CC_CAN_LINK := y
export CC_CAN_LINK
endif
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export), # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
......
...@@ -20,11 +20,7 @@ obj-$(CONFIG_TLS) += tls/ ...@@ -20,11 +20,7 @@ obj-$(CONFIG_TLS) += tls/
obj-$(CONFIG_XFRM) += xfrm/ obj-$(CONFIG_XFRM) += xfrm/
obj-$(CONFIG_UNIX) += unix/ obj-$(CONFIG_UNIX) += unix/
obj-$(CONFIG_NET) += ipv6/ obj-$(CONFIG_NET) += ipv6/
ifneq ($(CC_CAN_LINK),y)
$(warning CC cannot link executables. Skipping bpfilter.)
else
obj-$(CONFIG_BPFILTER) += bpfilter/ obj-$(CONFIG_BPFILTER) += bpfilter/
endif
obj-$(CONFIG_PACKET) += packet/ obj-$(CONFIG_PACKET) += packet/
obj-$(CONFIG_NET_KEY) += key/ obj-$(CONFIG_NET_KEY) += key/
obj-$(CONFIG_BRIDGE) += bridge/ obj-$(CONFIG_BRIDGE) += bridge/
......
menuconfig BPFILTER menuconfig BPFILTER
bool "BPF based packet filtering framework (BPFILTER)" bool "BPF based packet filtering framework (BPFILTER)"
default n
depends on NET && BPF && INET depends on NET && BPF && INET
help help
This builds experimental bpfilter framework that is aiming to This builds experimental bpfilter framework that is aiming to
...@@ -9,6 +8,7 @@ menuconfig BPFILTER ...@@ -9,6 +8,7 @@ menuconfig BPFILTER
if BPFILTER if BPFILTER
config BPFILTER_UMH config BPFILTER_UMH
tristate "bpfilter kernel module with user mode helper" tristate "bpfilter kernel module with user mode helper"
depends on $(success,$(srctree)/scripts/cc-can-link.sh $(CC))
default m default m
help help
This builds bpfilter kernel module with embedded user mode helper This builds bpfilter kernel module with embedded user mode helper
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 && echo "y" cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1
#include <stdio.h> #include <stdio.h>
int main(void) int main(void)
{ {
......
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