From patchwork Sat May 9 07:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 219570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 294C3C54E49 for ; Sat, 9 May 2020 07:41:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B33224953 for ; Sat, 9 May 2020 07:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589010073; bh=A+Bv+kXDJaiw7pPOKBqNwNiJ0ERz9X9rN9knbhsrZp8=; h=From:To:Cc:Subject:Date:List-ID:From; b=EJ/A5HcLEfGC6XvkoIjlof/tugeq13IP88hMrgNX6z3sMoZCDK0os7O0Kwj5fzlS6 j0vG21tlFYQK7PxP4d9Pff6AAThri76gy6hltBkomyOSb16SvAOQbZ3tYK1h9Bv4ve pfTgVRjBA3ez4n5FweQRneBqBoq7FKP3ntU7EqW0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727076AbgEIHlL (ORCPT ); Sat, 9 May 2020 03:41:11 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:30644 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgEIHlK (ORCPT ); Sat, 9 May 2020 03:41:10 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-07.nifty.com with ESMTP id 0497dIWX011106; Sat, 9 May 2020 16:39:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 0497dIWX011106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1589009959; bh=KgePt5Z+JlnBeaKU8E6URMI54TiET/zqI9kIhP/wJPw=; h=From:To:Cc:Subject:Date:From; b=n5wlmDB5eekPDUm9jcMEup7NyOZLHOf8Z5zGAp7F4Xm5KHC1P2aGY7F+A9O29ck9l MyKAGoR+u5fzyPn7TfZrkdxlhkvxvQ39X0JB/J0lmS8dcX65b86abQr//O9q0iTHzG xxupOsYCiUTTVBqb0WfIz7cW+f438s8xHi956MZiAvBM2NI1boRncyI1RSHyqOBWcC w6cOnyOtfq3iRflhvW7k3yII8UC+bDwI1S6qJta4R5zcGt4cqcGRveBoyOGx4wLjYs U6ZVW7sVbjaXzpZ8AvEbIMW/HfZw3558TXQwNA63E9ZE3A2muChc8EKpDI447LMNwh LO5OwGm7NVuLw== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Valdis Kletnieks , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Masahiro Yamada , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , John Fastabend , KP Singh , Martin KaFai Lau , Song Liu , Yonghong Song , netdev@vger.kernel.org Subject: [PATCH] bpfilter: check if $(CC) can static link in Kconfig Date: Sat, 9 May 2020 16:39:15 +0900 Message-Id: <20200509073915.860588-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fedora, linking static libraries requires the glibc-static RPM package, which is not part of the glibc-devel package. CONFIG_CC_CAN_LINK does not check the capability of static linking, so you can enable CONFIG_BPFILTER_UMH, then fail to build. HOSTLD net/bpfilter/bpfilter_umh /usr/bin/ld: cannot find -lc collect2: error: ld returned 1 exit status Add CONFIG_CC_CAN_LINK_STATIC, and make CONFIG_BPFILTER_UMH depend on it. Reported-by: Valdis Kletnieks Signed-off-by: Masahiro Yamada --- I will insert this after https://patchwork.kernel.org/patch/11515997/ init/Kconfig | 5 +++++ net/bpfilter/Kconfig | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index 57562a8e2761..d0ff16e93794 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -49,6 +49,11 @@ config CC_CAN_LINK default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m64-flag)) if 64BIT default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(m32-flag)) +config CC_CAN_LINK_STATIC + bool + default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m64-flag)) if 64BIT + default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) -static $(m32-flag)) + config CC_HAS_ASM_GOTO def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC)) diff --git a/net/bpfilter/Kconfig b/net/bpfilter/Kconfig index fed9290e3b41..045144d4a42c 100644 --- a/net/bpfilter/Kconfig +++ b/net/bpfilter/Kconfig @@ -9,7 +9,7 @@ menuconfig BPFILTER if BPFILTER config BPFILTER_UMH tristate "bpfilter kernel module with user mode helper" - depends on CC_CAN_LINK + depends on CC_CAN_LINK_STATIC default m help This builds bpfilter kernel module with embedded user mode helper