Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp372863imm; Mon, 4 Jun 2018 19:54:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKl3fhM0lu+fqOGhFWXwyOfhFi9gXlDeh+5s+DW604LOyS9lTpN5d27Bk4homEI+zPRqVDc X-Received: by 2002:a17:902:31a4:: with SMTP id x33-v6mr24608408plb.355.1528167298666; Mon, 04 Jun 2018 19:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528167298; cv=none; d=google.com; s=arc-20160816; b=aj+X7mqr/r6h+IlLnBXxzWQiQ9vRBHAdn1HvRrEVK0M7d7ftYX9CeyyjLdgwdAe6+J xvwlgqDYyyA1DWBAbkgASbS9dK6ht04c+xT5tkZN91VLCveObhmp3I2n31c7oSwLdt0k P8INJ5m0DGz394EC4seYdqlQz746K0o6kzuDWFi+pxQY1isB48GECd/7tKKKp15llt/5 KLSN0AJBsI3DjvXRy8vMrIBEgp17yjqb1X+ws+ap4U3dzJo+qscf3Ljb6AymR1EPirpD G35/MGLlSIr8BKoEeIoEJdXk13XKX17cWSHsJZUlDZRcnIsP8pzce2BEKtjobpksn82U EJ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject :smtp-origin-cluster:cc:to:smtp-origin-hostname:from :smtp-origin-hostprefix:arc-authentication-results; bh=eWCbYmutTpolnkNcOk3kOX/uYiihBQNRXNHQh0qWbEo=; b=kQMUhaeUuYySl8OqbdsmMHL8Q77hDnF8VTz2Aj2ap2ONovmwzy//p69Eb86D/z1qXY EYJOm3zQKDEdPr7XfoPfNwLYsikhYEeEAB6nAQBZhX8zL1X7lEX5vCIoMVFfY/YZoIx9 C8mA9O/h/53PSSz1mbm23FWvF6dEUGF8kuLRBu40/jJj7JlCQzJ5je/6MEkapvIwE21A 4M+xXKnv7BkmB5CESfLzQGKsjFr0bXBNCxhDgMeHbP8q3o+AO8ArqAx1W0ai82Yh5Xv+ rUUUhQf/6U8pBKicaqov1sdGC80MHSG4fRj+kog86DvlQcQcnb89hHP0saU0WoW/aA7+ z9Dw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si17611555pgt.659.2018.06.04.19.54.19; Mon, 04 Jun 2018 19:54:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751509AbeFECxp (ORCPT + 99 others); Mon, 4 Jun 2018 22:53:45 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:55870 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751451AbeFECxo (ORCPT ); Mon, 4 Jun 2018 22:53:44 -0400 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w552nHwr013748 for ; Mon, 4 Jun 2018 19:53:43 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by m0089730.ppops.net with ESMTP id 2jdfahrdwx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 04 Jun 2018 19:53:43 -0700 Received: from mx-out.facebook.com (192.168.52.123) by mail.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 4 Jun 2018 19:53:41 -0700 Received: by devbig007.ftw2.facebook.com (Postfix, from userid 572438) id 55CAD760AFF; Mon, 4 Jun 2018 19:53:41 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Alexei Starovoitov Smtp-Origin-Hostname: devbig007.ftw2.facebook.com To: "David S . Miller" CC: , , , , , Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH net-next] bpfilter: switch to CC from HOSTCC Date: Mon, 4 Jun 2018 19:53:41 -0700 Message-ID: <20180605025341.3965492-1-ast@kernel.org> X-Mailer: git-send-email 2.9.5 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-05_01:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org check that CC can build executables and use that compiler instead of HOSTCC Suggested-by: Arnd Bergmann Signed-off-by: Alexei Starovoitov --- Makefile | 5 +++++ net/Makefile | 4 ++++ net/bpfilter/Makefile | 2 ++ scripts/cc-can-link.sh | 11 +++++++++++ 4 files changed, 22 insertions(+) create mode 100755 scripts/cc-can-link.sh diff --git a/Makefile b/Makefile index 56ba070dfa09..62c110084fae 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/net/Makefile b/net/Makefile index bdaf53925acd..13ec0d5415c7 100644 --- a/net/Makefile +++ b/net/Makefile @@ -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/ diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile index 3f3cb87c668f..aafa72001fcd 100644 --- a/net/bpfilter/Makefile +++ b/net/bpfilter/Makefile @@ -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 diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh new file mode 100755 index 000000000000..208eb2825dab --- /dev/null +++ b/scripts/cc-can-link.sh @@ -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 +int main(void) +{ + printf(""); + return 0; +} +END -- 2.9.5