mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
bpfilter: switch to CC from HOSTCC
check that CC can build executables and use that compiler instead of HOSTCC Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
47a6ca3f97
commit
819dd92b9c
4 changed files with 22 additions and 0 deletions
5
Makefile
5
Makefile
|
@ -510,6 +510,11 @@ ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $
|
||||||
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/cc-can-link.sh $(CC)), y)
|
||||||
|
CC_CAN_LINK := y
|
||||||
|
export CC_CAN_LINK
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(config-targets),1)
|
ifeq ($(config-targets),1)
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# *config targets only - make sure prerequisites are updated, and descend
|
# *config targets only - make sure prerequisites are updated, and descend
|
||||||
|
|
|
@ -20,7 +20,11 @@ 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/
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
hostprogs-y := bpfilter_umh
|
hostprogs-y := bpfilter_umh
|
||||||
bpfilter_umh-objs := main.o
|
bpfilter_umh-objs := main.o
|
||||||
HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
|
HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
|
||||||
|
HOSTCC := $(CC)
|
||||||
|
|
||||||
ifeq ($(CONFIG_BPFILTER_UMH), y)
|
ifeq ($(CONFIG_BPFILTER_UMH), y)
|
||||||
# builtin bpfilter_umh should be compiled with -static
|
# builtin bpfilter_umh should be compiled with -static
|
||||||
# since rootfs isn't mounted at the time of __init
|
# since rootfs isn't mounted at the time of __init
|
||||||
|
|
11
scripts/cc-can-link.sh
Executable file
11
scripts/cc-can-link.sh
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 && echo "y"
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
printf("");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
END
|
Loading…
Add table
Reference in a new issue