Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 819dd92b authored by Alexei Starovoitov's avatar Alexei Starovoitov Committed by David S. Miller
Browse files

bpfilter: switch to CC from HOSTCC



check that CC can build executables and use that compiler instead of HOSTCC

Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47a6ca3f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -510,6 +510,11 @@ ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $
  KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
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)
# ===========================================================================
# *config targets only - make sure prerequisites are updated, and descend
+4 −0
Original line number Diff line number Diff line
@@ -20,7 +20,11 @@ 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/
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
hostprogs-y := bpfilter_umh
bpfilter_umh-objs := main.o
HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
HOSTCC := $(CC)

ifeq ($(CONFIG_BPFILTER_UMH), y)
# builtin bpfilter_umh should be compiled with -static
# since rootfs isn't mounted at the time of __init

scripts/cc-can-link.sh

0 → 100755
+11 −0
Original line number Diff line number Diff line
#!/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