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: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
82be2ab159
commit
88e85a7daf
5
Makefile
5
Makefile
@ -507,11 +507,6 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLA
|
||||
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
||||
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.
|
||||
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
|
||||
# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
|
||||
|
@ -20,11 +20,7 @@ obj-$(CONFIG_TLS) += tls/
|
||||
obj-$(CONFIG_XFRM) += xfrm/
|
||||
obj-$(CONFIG_UNIX) += unix/
|
||||
obj-$(CONFIG_NET) += ipv6/
|
||||
ifneq ($(CC_CAN_LINK),y)
|
||||
$(warning CC cannot link executables. Skipping bpfilter.)
|
||||
else
|
||||
obj-$(CONFIG_BPFILTER) += bpfilter/
|
||||
endif
|
||||
obj-$(CONFIG_PACKET) += packet/
|
||||
obj-$(CONFIG_NET_KEY) += key/
|
||||
obj-$(CONFIG_BRIDGE) += bridge/
|
||||
|
@ -1,6 +1,5 @@
|
||||
menuconfig BPFILTER
|
||||
bool "BPF based packet filtering framework (BPFILTER)"
|
||||
default n
|
||||
depends on NET && BPF && INET
|
||||
help
|
||||
This builds experimental bpfilter framework that is aiming to
|
||||
@ -9,6 +8,7 @@ menuconfig BPFILTER
|
||||
if BPFILTER
|
||||
config BPFILTER_UMH
|
||||
tristate "bpfilter kernel module with user mode helper"
|
||||
depends on $(success,$(srctree)/scripts/cc-can-link.sh $(CC))
|
||||
default m
|
||||
help
|
||||
This builds bpfilter kernel module with embedded user mode helper
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# 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>
|
||||
int main(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user