From patchwork Tue Jun 26 03:55:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 139913 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4736436lji; Mon, 25 Jun 2018 20:57:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMRQDYySMyAxqOk8mH5naxniiaZwnmsEaBVLJ2+qc6aOGNYkWSM+yY9mMdBaaDJpR1kMnx X-Received: by 2002:a17:902:aa98:: with SMTP id d24-v6mr15290609plr.185.1529985426686; Mon, 25 Jun 2018 20:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529985426; cv=none; d=google.com; s=arc-20160816; b=Yxd2o9hNuI2cCsH+8oJO0c8AtyA2XoSrQY7EaRJH7NOlHLsZMng5vMHzA93At4FZQa qyJKr8Bw70uoeAqtFdYB1T6inKIwpwhRf0mWop8r1/spkyhzMcWBOuyzBIIGUcmejt+C v5DT74Gk30n81jx7r4SGmipo85u26yU3aCkXXySoaUxQpBPWx7pyxTMZWIyGAztUYi7Z /xlVO/LIL3/EjiyfZwNNiuPq4u3YAR0/x/Fvvy9HC4ncNIUNz+kIeBu8nRCcuPn0BBAS k6Gk0jn95AQSyq9Liefe2BzAQDiWq7NeZIs18Rz+aML9dpUKTenhm+BX29gBYNHHqQwA nKaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=vFqrl0yfN2D/Um8ZkgXnGPldzzwp/IOIYE5gV2wf3gg=; b=afjw6B5UUGoATt/M3aIi/sU5xeVwdTixiEaBojz8kAxkqqt7OmLlGeFCbgPdIv72Y0 z7k0nf2FYbJKi7ldKnDOUHC6phn/kwtzUlPTBL+g1RPI6K+3iJIsXPlt0QPcVpl3MCg1 y9BUZB6Z0GQ1cHqpHP/5F4oEchmnVmO7E91DANVYzd4arVRqsae7J+Um/MWcGgU2mfXE KvbQjvB2G/Rs8gS32Mrx6Zg5vVadxBUlWtpGWERw4ONXx1ZfK75BZrG5Xind7qqT1AB3 yl1FR1AILrZcwjBG2AbTTIrYL/1/0DDAKdpekc+J0z33ujlWZokoKnnlhFBuSJNFnGdL 95eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oa1cSiFt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7-v6si685846plz.510.2018.06.25.20.57.06; Mon, 25 Jun 2018 20:57:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oa1cSiFt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935321AbeFZD5F (ORCPT + 31 others); Mon, 25 Jun 2018 23:57:05 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:60893 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934448AbeFZD5C (ORCPT ); Mon, 25 Jun 2018 23:57:02 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id w5Q3tpaS000721; Tue, 26 Jun 2018 12:55:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com w5Q3tpaS000721 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1529985352; bh=vFqrl0yfN2D/Um8ZkgXnGPldzzwp/IOIYE5gV2wf3gg=; h=From:To:Cc:Subject:Date:From; b=oa1cSiFtGbo3xFcbkILHI44EH0caJc1yPYmv+b3UFX0hUfRhMLBc5TQJGKI/HM81d 66MOoPWM0QCZHZm0JwJH9isI0l788nptAuRsUlmUUPnRLJT5GtkYPUFh7fdsLw0muG 3efFkgw0mEyXWp0rE2rnAy7y39CWuBv/r2Lg6MPnqvfEQOpvSFJbRTs4jigvybi3Kj BCJc0wu2ZmdZK9c7NRR08SmuicpoIzTcHoMmBhRrxko9z8PuluWpxJaGJP+TV4ywP3 c36ax+ldMl0E31C/GUpl/TjxpCcEV0xzP9gpq4C+e7NtQXj6ItLNn81Z6z3bV2fL/T BJvxvHvRtPQVQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: "David S . Miller" , netdev@vger.kernel.org, Alexei Starovoitov Cc: Matteo Croce , Arnd Bergmann , Masahiro Yamada , linux-kbuild@vger.kernel.org, Alexei Starovoitov , linux-kernel@vger.kernel.org, Michal Marek , Daniel Borkmann Subject: [RESEND PATCH] bpfilter: check compiler capability in Kconfig Date: Tue, 26 Jun 2018 12:55:35 +0900 Message-Id: <1529985336-27522-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Makefile | 5 ----- net/Makefile | 4 ---- net/bpfilter/Kconfig | 2 +- scripts/cc-can-link.sh | 2 +- 4 files changed, 2 insertions(+), 11 deletions(-) -- 2.7.4 Acked-by: Daniel Borkmann Acked-by: Alexei Starovoitov diff --git a/Makefile b/Makefile index a6d4872..f71ea52 100644 --- a/Makefile +++ b/Makefile @@ -520,11 +520,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), diff --git a/net/Makefile b/net/Makefile index 13ec0d5..bdaf539 100644 --- a/net/Makefile +++ b/net/Makefile @@ -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/ diff --git a/net/bpfilter/Kconfig b/net/bpfilter/Kconfig index a948b07..76deb66 100644 --- a/net/bpfilter/Kconfig +++ b/net/bpfilter/Kconfig @@ -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 diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh index 208eb28..6efcead 100755 --- a/scripts/cc-can-link.sh +++ b/scripts/cc-can-link.sh @@ -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 int main(void) {