From patchwork Wed Mar 14 16:44:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131662 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp395397edg; Wed, 14 Mar 2018 09:45:21 -0700 (PDT) X-Google-Smtp-Source: AG47ELtq3I+L7klXuqxCKieRaafA/tCeAGXDI+MeKOjMLiHGiPDfLTFPEK/ClZVZLOZMDCbiOucx X-Received: by 10.101.88.130 with SMTP id d2mr3615089pgu.383.1521045921639; Wed, 14 Mar 2018 09:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045921; cv=none; d=google.com; s=arc-20160816; b=vrGWRgOCkY+x/TvVyQf2kXuMI1InhbtwIzHfX5Gd9SdJM9vz6hfmkK8ZvcJ3RPx8uX UbPDj1eaa+T3HHxtY7TAqAndciSDa5ESgPXIgey3eisBz+JIlD9+nzBPh5UwpDv4Wwjs ZlW+FTWVsprPQxt9Y8y1XI2Aneomh+tZXHvSDrJlHDKux6ilsfyBQOZpx+eIRIaZcxyr xmLNvpks+VcF5/qtPHH8ubUBsoznUFfoBNUEhJ9DpIhL0cPbL2MrCCATh9qkZ+xr1oGt bBJUvmwUQgqSIqTiyJilhhH8qhF7ZdY3uxtDhbpsyI2DzVYlGhxTr4XkhLY6RtR+E3E8 mKRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=rZdk33WL6Gk9eT7mvhU50hhZ8Pd9TQR1stfGTmFlPRo=; b=Gr33w4VFfFwL2bSME/SI89YVxZP685Xi//UasSNxUxn/tbVlOU2pH9wHDFMLt73Rmz zBpMB72dzoiaKd8shHOjrjL2DtwmzspmvDelYOPQCqqHXI7rYMlJeBaT/x6Zrxodfn5a iJfFEkcAGibIflEEQIRFrEglcof6/MxN8XSJUBGeNvsEjQZOX0XrSKVIYR3Pi4KT5qTY R6JuS2zt++HUEUtcpk5x4EMMPVoTLA3AFIeg4VmZP8plvtl2a4H3fvLHS7sN2m7ek/J1 C0VWIqNkRprcT870WH7pCcU0V9IPBWjB1/E8550pYf4M0QAlEdhOSTbrdXQmFC3Zvcex vuqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=0ebjLzbW; 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 u23si2043271pgv.706.2018.03.14.09.45.21; Wed, 14 Mar 2018 09:45:21 -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=0ebjLzbW; 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 S1752432AbeCNQpT (ORCPT + 28 others); Wed, 14 Mar 2018 12:45:19 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38070 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752081AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdQ001049; Thu, 15 Mar 2018 01:44:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdQ001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045869; bh=rZdk33WL6Gk9eT7mvhU50hhZ8Pd9TQR1stfGTmFlPRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ebjLzbWpkhk1aTwcjaZl+QySTzU4KM8t+kxp3KcHLj0p5jKwU233n7kJNjpICaWu 1F/QfvQbZpWNHCqGylJb/ZdB3p0LXA+tVJ8Hjez7ZkCdXTAshIz6rnOv+djKGycX9Q VOsGg9ih9ZXBQ4uwHYgptQ3B4LxLY2BzuntxpNUV/MdbXlJzKHvn/UCm4f04SXup7t ynN7UCFvPLsAD6T22yfqK1fe1UhThprsButjMSRydCeMIKfDf+HRxGHr/tEvuFpSQG yYbpwmDy2alQLIKMnCO51vp7hwXpyb7qAt0vlZuVi79iUWBvg0dsJ9BDaJMd4z96+S FJ9Fj5GgDCUyw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/7] kbuild: clear LDFLAGS in the top Makefile Date: Thu, 15 Mar 2018 01:44:15 +0900 Message-Id: <1521045861-22418-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently LDFLAGS is not cleared, so same flags are accumulated in LDFLAGS when the top Makefile is recursively invoked. I found unneeded rebuild for ARCH=arm64 when CONFIG_TRIM_UNUSED_KSYMS is enabled. If include/generated/autoksyms.h is updated, the top Makefile is recursively invoked, then arch/arm64/Makefile adds one more '-maarch64linux'. Due to the command line change, modules are rebuilt needlessly. Signed-off-by: Masahiro Yamada --- Makefile | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/Makefile b/Makefile index e02d092..5eb5d9d 100644 --- a/Makefile +++ b/Makefile @@ -426,6 +426,7 @@ KBUILD_CFLAGS_KERNEL := KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds +LDFLAGS := GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC From patchwork Wed Mar 14 16:44:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131664 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp396234edg; Wed, 14 Mar 2018 09:46:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELtOBRNCmtgnQ1EjKDd+OPiszi1sY48ztr3NUb7VRr/+PfP5kw5FqvU53ts2WAVNKXk+mowk X-Received: by 10.99.181.78 with SMTP id u14mr4227831pgo.205.1521045966186; Wed, 14 Mar 2018 09:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045966; cv=none; d=google.com; s=arc-20160816; b=YlRqKtFcNpyjrIQhuMEmO2RpGwOgMADhXm3nKcInYybS3RUlB61U4RuzSCqczRgvvQ HaW9UBWXXrNxpPJCMOUQ3I0Iz1ZoiP+xdVCbWwMjjFowBRZz08dtO8lO+bsym8gtJtew EUGI8HV6Wrl7afKURxjmAOagUsgw5XtteznhPemHNnF6ef+bxdYkh3C3mzDt0CEJeWEC wWLn3Us6GIkULJm3jQYp7n2tuKjJiraZq5IycAleYZrTRlvOYMLm/GVCkwsBS28YqB6Y EkJxxXb3pfKw0Cb/5kczlu6RyNLHLTUYyFMF1C2ucudGHX4eN9NCIK7NZrhLaA5fBAZK s8Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=qS8ZrdRf9XHD8YrmVGsQu3gGqtOQYjvzAbZGrAMcBlY=; b=EmasEzSV87UgkyWA6whTYzlG4+ktqJrryjxyqKSqmtTkDz95vr829oBWFgiUZZ4Qua DxSdzWLqs3o3QDj5r6j8FOOQismhpFshVLUkb1ayBi3fhGbvRWEIb4zNWoSmwoW9SjFB cYIlqRXWUCyBOgmcPeD9jXZKhHrNVe17ycqItJkFZKsUQeHJWGMwHLgDvyLLIja/w5O1 Pa3LlNeSj3/elSlQgK1Z/DFN+JSbmAIn6V7aTuYX5WF4uC0Vf8/3h/hiPj28rxtYDH5g q3YFYJApdajEiiJH45FkJ0yn1znCtUib5QKHRp1pZvFroHgcIan8erCaMBKvUxpWdHxd KvQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=o0DSULOl; 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 r23si2096428pgv.368.2018.03.14.09.46.05; Wed, 14 Mar 2018 09:46: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=o0DSULOl; 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 S1752495AbeCNQpt (ORCPT + 28 others); Wed, 14 Mar 2018 12:45:49 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38069 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751988AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdR001049; Thu, 15 Mar 2018 01:44:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdR001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045870; bh=qS8ZrdRf9XHD8YrmVGsQu3gGqtOQYjvzAbZGrAMcBlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o0DSULOlkLqKysbQcJxF5DU/q/ywklFIdnqyKVBzJlVtxQPqkUeb5W4QD9zfjZ1Wz ddR6bgizKIWQwgzq3EiJ1wtMlgg67GS/btSIqyK1AByok5SwJcpT+QnhiB28yq4lhZ /7DVcVEhpIHIDOiYl9ICuHJrbIBqqZ/dhSWLHCDDmIlFIjXsjAxsmVawdxErAaPAkL R9FiBm2HMu6Hufhryev8ho33PxR3mlsWAnVFhPX3dONpMdFEVaP9hizDXV4y+5Cqg4 2Huk/t7G+/3a+lfTvUnIiC50aF72UEpziX+rSqwHWmWTrWA3UGm3ile9fdq+BKqpo3 9T59TnWwm8S6g== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 2/7] kbuild: touch autoksyms.h when it is really missing Date: Thu, 15 Mar 2018 01:44:16 +0900 Message-Id: <1521045861-22418-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >From the comment, I expect this code creates autoksyms.h in case it is missing, but it actually touches it when it does exists. Signed-off-by: Masahiro Yamada --- I do not know when this code is useful... If autoksyms.h were missing, build should have already failed because include/{linux,asm-generic}/export.h need it. Maybe for standalone test? Or, in order to make this script self-contained? scripts/adjust_autoksyms.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 513da1a..a52210b 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -49,7 +49,7 @@ case "${KCONFIG_CONFIG}" in esac # In case it doesn't exist yet... -if [ -e "$cur_ksyms_file" ]; then touch "$cur_ksyms_file"; fi +if [ ! -e "$cur_ksyms_file" ]; then touch "$cur_ksyms_file"; fi # Generate a new ksym list file with symbols needed by the current # set of modules. From patchwork Wed Mar 14 16:44:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131665 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp396468edg; Wed, 14 Mar 2018 09:46:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELsvO3wiqj7r5x4U/7BUFgPIHaKDsHIEf7AIBm3AWiKoQEPK9279dGAzkw9p89JCioluyRq3 X-Received: by 10.98.31.155 with SMTP id l27mr4968193pfj.176.1521045977611; Wed, 14 Mar 2018 09:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045977; cv=none; d=google.com; s=arc-20160816; b=UqnrWuKk77k4ifdNQzIZ5JxqQ3DCGqEuC59kSKLIMSjd4feW9MWU0DCAMAENG3jIoT CDddH/w64zJh+TgClf62En8A5DNK8kwWxu/MrQfb2Io9UfncFyPLKAP0QEaGDt4Ud8m6 qtrjxsi9qqS6L9O8ZL+c++t4scESWk3EO5iNwe8vFFxjwQyGie0cPSdEYbJ+gKfVzT3w SPOHKiDSCy6qGwRanipyCmpm9aXh8V3W8+O6rd7NPAT8lLle0U7sKPxEz2t2cSG8Mnd3 uchqlvXrc+0tvOuJOCJyZG8kimqLohli93bg9HyVCplvv6KSomUq5je9m+38JbJisz/E QzLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=B6r7DF0nix1PPbyiSEnJ46Y4cibwUOXoFNmD7C4KdDU=; b=I/t+l6+TBntrKTaWcExYRHlK5YTWB62x1SjrCo1MY8Kix+UP5s/AduDguifa0ybB5q 6pRsCyqj7VU2G9Vu6bgekiu6f5kaz9VW5vnNI8pHE1JcB1pznyiDS4Gc20PYcYbI8KOS iaQ/yUgNfBSiZTUtFqUf61IcjbfdBTgtMzWb4FGpIrFyrPQYx4DVyTyK4gtLqLZhrlha i1uOKRq6K9UExUsVy0FF3k3w+e5YYK06/OYKs61HzamfsYccq7HQiODl9b9pLAOfbYkm Xbih9LeVKMQJIlaPwph4SSUdOIT/2Zc2jGQCmfbTyXpOP9ind8XU5rAeQyQQaU/BG2FO /eRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2q+rmX/J; 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 ay5-v6si2203089plb.106.2018.03.14.09.46.17; Wed, 14 Mar 2018 09:46:17 -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=2q+rmX/J; 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 S1752474AbeCNQps (ORCPT + 28 others); Wed, 14 Mar 2018 12:45:48 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38067 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdS001049; Thu, 15 Mar 2018 01:44:30 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdS001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045870; bh=B6r7DF0nix1PPbyiSEnJ46Y4cibwUOXoFNmD7C4KdDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2q+rmX/Jza5uBgAu/gmYcuNZe6LmSZSyfZ/knTQ2VfBDRNdIMGRU6rZIPBVXBlPZG 6faZypGHD2qacDPJ3ajKYGiL8Bc1MdL3q0uNzTfF2mTZaScrWrRjNbLYMoxEN/nXfK uI1yzvuALLCXd+y4MO7n+Y0sNgtdcJdSrRVMJcx89xSChaGk8sDRzL8S4abtJo0Oi6 044X9RP8emzHWeDqo+UhIwA4NfVWIgTj24jtS5tV7o0QedEgliQLq09STEzz8tzAtG 42qBKbcw+Rkfysn6y2bx9BEUDnwQbbJmM2vaNvGNWE3uiwIq/ppeoEG6LIa+zk8VQC XkZb7OrItZYVQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/7] kbuild: move 'scripts' target below Date: Thu, 15 Mar 2018 01:44:17 +0900 Message-Id: <1521045861-22418-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just a trivial change to prepare for the next commit. This target is still invisible from external module building. Signed-off-by: Masahiro Yamada --- Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 5eb5d9d..fab0e19 100644 --- a/Makefile +++ b/Makefile @@ -556,14 +556,6 @@ endif export KBUILD_MODULES KBUILD_BUILTIN ifeq ($(KBUILD_EXTMOD),) -# Additional helpers built in scripts/ -# Carefully list dependencies so we do not try to build scripts twice -# in parallel -PHONY += scripts -scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ - asm-generic gcc-plugins - $(Q)$(MAKE) $(build)=$(@) - # Objects we will link into vmlinux / subdirs we need to visit init-y := init/ drivers-y := drivers/ sound/ firmware/ @@ -1059,6 +1051,13 @@ endef include/config/kernel.release: include/config/auto.conf FORCE $(call filechk,kernel.release) +# Additional helpers built in scripts/ +# Carefully list dependencies so we do not try to build scripts twice +# in parallel +PHONY += scripts +scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ + asm-generic gcc-plugins autoksyms + $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel # or the modules are listed in "prepare". From patchwork Wed Mar 14 16:44:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131660 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp395025edg; Wed, 14 Mar 2018 09:44:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELvnkIQMHHJL0HT3kdjv3aMUmbRkBhLXLTlHu/L/tyebHAIh83KkWLEb9rup3+GEIVhlONqs X-Received: by 10.99.170.5 with SMTP id e5mr4134773pgf.92.1521045898284; Wed, 14 Mar 2018 09:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045898; cv=none; d=google.com; s=arc-20160816; b=nJjFfi0CHak5Z2PF3/lKo3L33cGUtX75EXh9SbC2DViPTIw0ZbJSzoLCA1hy4cHPUk W0D1o0fgDqOJ0QD+PYZwKccLhdS+c9V2sukAjqk5K313sZFOh0a7m5DAk1EeoVJG93oJ yuW0az/oO2RbVAMr6XWCLWeY/vU117vwSK5LUHPu9uqkwwZfP6LZENiLmcx3wGppzTL/ 5Phcki4jkeUPp5nGg/GmBulm7zUcHQDvJYc/pRFT15e/n9eutH5g5XGqVREkOEgiRFY3 pnyWdu9ZAiQEuoG7ZOHF17XV+zITYsje8bNU4X1dYfwKeZfnQUK4C9vYKl5YtLELfPna tx2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=XPg/051uhOYecD3z3Ngs9j9G5O7xXZ1sX8T2goNtKzE=; b=fT3Pz0LHLI32poMvXOY9ugCyF/WLRBGoXtmN6kGJ8fWzxpVCe89G8R4/Wvtckxurde Zy9ORdGmMXJ5/9INj9gE4oClHef3TczXbooK2S4yMrVX3M1KUUzkd2cSrS1UawBzO2Pc 81r0dX/1wPB33G/4bsRSPz/DLJHt1Ult5gJEF53L/6mmYKn0ik4hC8xxUObQF4GKYM40 ZZKMUiRuT0rMXXMM4FA5oZD+DFUa/UqVKcP8LcNMsC1cJ9Sr5Xcgj5vGMEdaF6wMJ7XC Z6UBPlGIsMrU1XLVbVFmQiuieM0Of+u8iWAQUVIwtJe4b4tPKx5Ui5+JQTxsSNTXf9Sm vhMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=G55HGPMG; 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 x10si2350213pfd.188.2018.03.14.09.44.57; Wed, 14 Mar 2018 09:44: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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=G55HGPMG; 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 S1752348AbeCNQoz (ORCPT + 28 others); Wed, 14 Mar 2018 12:44:55 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38074 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdT001049; Thu, 15 Mar 2018 01:44:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdT001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045871; bh=XPg/051uhOYecD3z3Ngs9j9G5O7xXZ1sX8T2goNtKzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G55HGPMGUnRKXoILJNMOcpdieRjT2lP/ZfVUojeP9Bb3VFveLCfI3mPi54vPyG/Dz rtUwLrmPcxYLhREIh7Gt5VCtnLPjhVOzyztPoHnkSrsZh1LxvHZWveJ7myY9EGzJ7p 1WzS0QkkFABnZlNDFURtCRbSNB0MOxd0Z38eSGMltgEihOR3SiG7EjDZz+khtY4EnQ zj+hkeuCrRjpeyvpP5sIOxZxwGVwpEfVuR/OxoP+yW/jpeBRI+/VrbU6HqtVNF3+D9 yXqMAaz1T4YsRVQ7oj2SdVvk//lZt+NSfAkxg6wdT/6fnPcz4DPsIP1PXYxJk5zE9L EaTYCYFhkTWQA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 4/7] kbuild: restore touching autoksyms.h to the top Makefile Date: Thu, 15 Mar 2018 01:44:18 +0900 Message-Id: <1521045861-22418-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit d3fc425e819b ("kbuild: make sure autoksyms.h exists early") moved the code that touches autoksyms.h to scripts/kconfig/Makefile with obscure reason. >From Nicolas' comment [1], he did not seem to be sure about the root cause. I guess I figured it out, so here is a fix-up I think is more correct. According to the error log in the original post [2], the build failed in scripts/mod/devicetable-offsets.c scripts/mod/Makefile is descended from scripts/Makefile, which is invoked from the top-level Makefile by the 'scripts' target. To build vmlinux and/or modules, Kbuild descend into $(vmlinux-dirs). This depends on 'prepare' and 'script' as follows: $(vmlinux-dirs): prepare scripts Because there is no dependency between 'prepare' and 'scripts', the parallel building can run them simultaneously. 'prepare' depends on 'prepare1', which touched autoksyms.h, whereas 'scripts' descends into script/, then scripts/mod/, which needed if CONFIG_TRIM_UNUSED_KSYMS. This was the reason of race. I am not happy to have unrelated code in the Kconfig Makefile, so getting it back to the top Makefile. I remove the standalone test target because I want to use it to create an empty autoksyms.h file. Here is a little improvement; unnecessary autoksyms.h is not created when CONFIG_TRIM_UNUSED_KSYMS is disabled. [1] https://lkml.org/lkml/2016/11/30/734 [2] https://lkml.org/lkml/2016/11/30/531 Signed-off-by: Masahiro Yamada Commit: The discussion happened in Nov. 2016. I was not involved in it. I was not the Kbuild maintainer at that time. END --- Makefile | 12 +++++++----- scripts/kconfig/Makefile | 2 -- 2 files changed, 7 insertions(+), 7 deletions(-) -- 2.7.4 Acked-by: Nicolas Pitre diff --git a/Makefile b/Makefile index fab0e19..decc870 100644 --- a/Makefile +++ b/Makefile @@ -1010,9 +1010,11 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS "$(MAKE) -f $(srctree)/Makefile vmlinux" endif -# standalone target for easier testing -include/generated/autoksyms.h: FORCE - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true +autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) + +$(autoksyms_h): + $(Q)mkdir -p $(dir $@) + $(Q)touch $@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) @@ -1056,7 +1058,7 @@ include/config/kernel.release: include/config/auto.conf FORCE # in parallel PHONY += scripts scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ - asm-generic gcc-plugins autoksyms + asm-generic gcc-plugins $(autoksyms_h) $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel @@ -1086,7 +1088,7 @@ endif # that need to depend on updated CONFIG_* values can be checked here. prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic -prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ +prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ include/config/auto.conf $(cmd_crmodverdir) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index cb3ec53..eb139a1 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -38,8 +38,6 @@ nconfig: $(obj)/nconf # for external use. silentoldconfig: $(obj)/conf $(Q)mkdir -p include/config include/generated - $(Q)test -e include/generated/autoksyms.h || \ - touch include/generated/autoksyms.h $< $(silent) --$@ $(Kconfig) localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf From patchwork Wed Mar 14 16:44:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131666 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp396769edg; Wed, 14 Mar 2018 09:46:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELuam4StOxI5AJd8AQCtHqr38gsAyXFQQpaE99lYfQEiSRo4N07dkoHIuKFSW/LlnE4RatzP X-Received: by 10.101.77.201 with SMTP id q9mr4157277pgt.395.1521045992554; Wed, 14 Mar 2018 09:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045992; cv=none; d=google.com; s=arc-20160816; b=VNFNwcnTiwz9RPmAEsKpAfkVVdXHzABpO4itojCXELqLXXpPPMgzOulCCED0m9YsSw 6cd8ZLTOmN+c71gETmG5frkplA6yKzM5Aslmf8KFfpZgLYtcHIpARW43egIb5N7dfyJU qV3Pcci0ymJft4rfDE6ZI0FJCFh6DeO/3oLq+u79wCqmJ9QO25A/Y5P4mqtB0ogXeYd8 A/nhVpyW1/69n1SH4Qj/FH8y/hFFJ6ORAQHinPp7+cxutHgJI982w63pYlupXZDslv81 BewkmYc7ipqXfKOaODPOPE13XHH6jx97haCEwLKuPWX7Q0AnhqIvlPiYMiFam84AYV4f cQxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=TIXfCUdZkS5aRgqp+isLNSormzEPrcpuAah9T7fOvkQ=; b=DLu/HsWebCdfIFJjnTl0zDcmyN2J0Nqyj5mzJoFRyRclcpv+lutqG2/e/fKjipip0a tjTN39PsHoCUZ5ntGR3YeCY2X3Q6KAu+lceqD0FQxlHJb2lfMSU8xe7Wh1282IIE0aIl BbP2DhqFysPmrKXVI3ziCQfJPfqzD3WW/wdRac6XuEbbpG4rFCV0RZhebQlp21fOKT8e XyOowDvxH8D4R48tbGgSjtEDN4BsyJR9WWOch8nB0wah5d00ev1N7pIVQagVp5vy/gxw 2zT1jqUCGvqxXpLplANwiwJ8Cx3tQ8YdvxIuLs05OD1Ou7dGmGg3qXycTe6Me9GZ52h/ tWyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=woFL4XaZ; 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 z13si2300285pfh.217.2018.03.14.09.46.32; Wed, 14 Mar 2018 09:46:32 -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=woFL4XaZ; 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 S1751456AbeCNQpp (ORCPT + 28 others); Wed, 14 Mar 2018 12:45:45 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38068 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752011AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdU001049; Thu, 15 Mar 2018 01:44:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdU001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045872; bh=TIXfCUdZkS5aRgqp+isLNSormzEPrcpuAah9T7fOvkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=woFL4XaZpzRnO909Xx4xLprKvdYlnDO8uwuYyDA7MDTqfGnkBJafr4IMsGbBJ6kN/ eUBjLiJv5xchFY9DCUh4DX59i8nXdhHy0hCzCw89Wn+YmJoWmLtpMCgXBPG7qV3dPk a9Vru4bLP5dkS7wwi106mrBO3Q6oVuvkEpzZAz19M/Zrf9gx1WuydMlqzjszHANGpX ulNMgQESb9/TFJuMVqU3sV5+1ltVmqRSS1YIROkJ6ZOis0aUUnOWMMOIK9bdEEbRjj fE6zwKGL1ujN1IlYQupkAicoWaom2mrBeywVTx7GoCOS/fnp1KHD4YCdi6iqVFex38 CzZBUWzyTbOqw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 5/7] kbuild: hide CONFIG_TRIM_UNUSED_KSYMS code from external module building Date: Thu, 15 Mar 2018 01:44:19 +0900 Message-Id: <1521045861-22418-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_TRIM_UNUSED_KYMS is enabled, KBUILD_MODULES is set. This code is unneeded for external module building because KBUILD_MODULES is always set. Move this code inside "ifeq ($(KBUILD_EXTMOD),)" conditional. Signed-off-by: Masahiro Yamada --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.7.4 Acked-by: Nicolas Pitre diff --git a/Makefile b/Makefile index decc870..e60b16f 100644 --- a/Makefile +++ b/Makefile @@ -603,13 +603,6 @@ else include/config/auto.conf: ; endif # $(dot-config) -# For the kernel to actually contain only the needed exported symbols, -# we have to build modules as well to determine what those symbols are. -# (this can be evaluated only once include/config/auto.conf has been included) -ifdef CONFIG_TRIM_UNUSED_KSYMS - KBUILD_MODULES := 1 -endif - # The all: target is the default when no target is given on the # command line. # This allow a user to issue only 'make' to build a kernel including modules @@ -1010,6 +1003,13 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS "$(MAKE) -f $(srctree)/Makefile vmlinux" endif +# For the kernel to actually contain only the needed exported symbols, +# we have to build modules as well to determine what those symbols are. +# (this can be evaluated only once include/config/auto.conf has been included) +ifdef CONFIG_TRIM_UNUSED_KSYMS + KBUILD_MODULES := 1 +endif + autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) $(autoksyms_h): From patchwork Wed Mar 14 16:44:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131667 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp397204edg; Wed, 14 Mar 2018 09:46:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELs6jC2ob/YIfMF35OnjoJVaxSXg9kCjCgkK52Joeqc1/GMgJeVVcnppR/Xd46Z0mwospwFx X-Received: by 2002:a17:902:161:: with SMTP id 88-v6mr4637587plb.212.1521046017667; Wed, 14 Mar 2018 09:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046017; cv=none; d=google.com; s=arc-20160816; b=burmPgLrzPd8uxh37mwmmCYXRcrh7JHd1+UU4YXuNvKVxDjtYsYah7XZilnfsbl74e si1pI7/dJmpOLLw6e8ZLT7fy4CcmqbKxjEm9YPbXlI9BLVkieBi4nGoJ6jAk1fe085kx RV6YCEJZ+HadVUQgMYC6qnWaNBdWeCyFdcVLPRjya0+sYitjd8ibckrjNruwFbUwbQJ/ uaI6Mal5NYpx35Qfqc5eWofosJGrDNwQDtVpa4bfAO6Gfg6qr+lS7GnrdlniCQJdV/wo gFyN30ZzOP8fOVrXABrqJE3rBfB39gXuQljX6kC4nbSisktiRN1UCpcP60xTSgbnk33k UKWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=slnOVu8qFRQHoVhiQqgOoyKaEpxgMr2agyULwrb7FWI=; b=D7kO0lhU9w+gEDJLKq0glkI1/dFjqOHQIQXLAzxcJtRlyzmvvCxki0Bzj9TI3q9INC StAleZ996602maGu+vtg3xjWhf6W9P1r0Et+oN8VsOeRxmrBYc8EFFqw+FdN0nrke6wB aFv+KtjRlbEkjNXgIKKjeH+vMhr2aq3SnDSJKpd8gkI0KlOjeidX39WJDX3LfS3CeRcl N4GK4zFcGjdHZYE8/7v8oGEnS3mIgBUOIPhxFYWz5hktpyBDQaCTGfB83vEh3rX04r/u djIe+LHLuyldG2hQ+Mi+rCdZ+i3iZhT3Q1t+5SQz0r7BPqRS7Np3YCFawsG2iE1qdLs8 DkfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=fcykLdfn; 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 71-v6si2258016pla.707.2018.03.14.09.46.57; Wed, 14 Mar 2018 09:46:57 -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=fcykLdfn; 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 S1752189AbeCNQpo (ORCPT + 28 others); Wed, 14 Mar 2018 12:45:44 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38073 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752078AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdV001049; Thu, 15 Mar 2018 01:44:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdV001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045872; bh=slnOVu8qFRQHoVhiQqgOoyKaEpxgMr2agyULwrb7FWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fcykLdfnB+UxmW+RoHlqENfTX3O4ehmBeiMUQjJPvpWd8I6DGSGKeLpMI72EP8Eev 1qm+oD/93BrSKQYKwbfHk+ojgC9kX2mQ6djkitZbQe6xrf4rbbfiMMp9ohjBHsEMGh VbxsPJNefR0qFx6safVzOLDhFS4yPWpH4UQDf4KrOoe2IzZ0cN0xzbAxfVr1iLu4sr mus4k62tNGFL6NWWySQwxL853SOUepK/su79zb9d6FBmh77czTUw9Wisr7rNTuKIEB ZH0Xi9uKCHR6H3Usa3Q3/OdfuKqQtItl6hDoHZb1ZjzurDGs5L+0lRGOZwHuF9mbIu 45gLS4LGP5eAw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 6/7] kbuild: move include/config/ksym/* to include/ksym/* Date: Thu, 15 Mar 2018 01:44:20 +0900 Message-Id: <1521045861-22418-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The idea of using fixdep was inspired by Kconfig, but autoksyms is unrelated to Kconfig. So, I want to get those touched files out of include/config/. The directory include/ksym/ is removed by "make clean". We do not need to keep it for external module building. Signed-off-by: Masahiro Yamada --- .gitignore | 1 + Makefile | 2 +- scripts/Kbuild.include | 2 +- scripts/adjust_autoksyms.sh | 2 +- scripts/basic/fixdep.c | 8 ++++---- 5 files changed, 8 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/.gitignore b/.gitignore index 1be78fd..85bcc26 100644 --- a/.gitignore +++ b/.gitignore @@ -87,6 +87,7 @@ modules.builtin # include/config include/generated +include/ksym arch/*/include/generated # stgit generated dirs diff --git a/Makefile b/Makefile index e60b16f..1dab647 100644 --- a/Makefile +++ b/Makefile @@ -1327,7 +1327,7 @@ endif # CONFIG_MODULES # make distclean Remove editor backup files, patch leftover files and the like # Directories & files removed with 'make clean' -CLEAN_DIRS += $(MODVERDIR) +CLEAN_DIRS += $(MODVERDIR) include/ksym # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config usr/include include/generated \ diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 065324a..045971e 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -368,7 +368,7 @@ ksym_dep_filter = \ $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;; \ boot*|build*|cpp_its_S|*cpp_lds_S|dtc|host*|vdso*) : ;; \ *) echo "Don't know how to preprocess $(1)" >&2; false ;; \ - esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' + esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/\1/p' cmd_and_fixdep = \ $(echo-cmd) $(cmd_$(1)); \ diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index a52210b..7bb3618 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -81,7 +81,7 @@ sort "$cur_ksyms_file" "$new_ksyms_file" | uniq -u | sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" | while read sympath; do if [ -z "$sympath" ]; then continue; fi - depfile="include/config/ksym/${sympath}.h" + depfile="include/ksym/${sympath}.h" mkdir -p "$(dirname "$depfile")" touch "$depfile" echo $((count += 1)) diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 449b68c..f387538 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -113,11 +113,11 @@ static void usage(void) /* * Print out a dependency path from a symbol name */ -static void print_config(const char *m, int slen) +static void print_dep(const char *m, int slen, const char *dir) { int c, i; - printf(" $(wildcard include/config/"); + printf(" $(wildcard %s/", dir); for (i = 0; i < slen; i++) { c = m[i]; if (c == '_') @@ -140,7 +140,7 @@ static void do_extra_deps(void) fprintf(stderr, "fixdep: bad data on stdin\n"); exit(1); } - print_config(buf, len - 1); + print_dep(buf, len - 1, "include/ksym"); } } @@ -208,7 +208,7 @@ static void use_config(const char *m, int slen) return; define_config(m, slen, hash); - print_config(m, slen); + print_dep(m, slen, "include/config"); } /* test if s ends in sub */ From patchwork Wed Mar 14 16:44:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131663 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp395605edg; Wed, 14 Mar 2018 09:45:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELs9Hm9lV/8n24KgXgGfWknowCA0eWM0nzrEGL1LSCP8tjMwuf99hogtLLcUlZ2rMIstK27S X-Received: by 10.101.98.17 with SMTP id d17mr4295930pgv.221.1521045933312; Wed, 14 Mar 2018 09:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521045933; cv=none; d=google.com; s=arc-20160816; b=VD8cNZw8ggCjp4vn8iznAFpSoZtLt1LuSwLPg1xgZ/hbLoEgLg2d+voPSEg3f5w7EI mKfLYnyKynsGd+973iWFpPIkMxcHuYqKYNHwVcqpaVv/3cdD/kWZt0lgmiQhC6fySYLt 5+A3I3Dw5EiOV2sxLappllQdH/xf3I8Iva6hvZaB7sLhx6QcvbpHt60sUqQ+4Qr8S9vF xFPtIyA9CpoDqhd4IehV7ICPIrmbx3ckw44jckpTFuMAcDsby0yl4EwBAA80ZG8P5bkN kFrGcfMOR00XEwJrpMjpueTncvBA5cWTMSlEum1KnLdhx7Z52mPsYvvu4CXqukN0SuX3 rrsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=uGo9GFfQJW1c2MIT/TgCFg5KX36rVzYNdYKZzcBa5os=; b=LG8QmDZj5CdVqjfZ8eQeLwXxEfqe3Z9utInWwYVzSAMIJcYlENFqyY+OmqI6JJXVUX iVYykqPhBQ0DRFKA7mH44mMfM/RiW1n274KkiBQD3KVAJa91FHDsqRuWCI2NIGSsmmlu kQjMS2dsKMiVR2OCe4rV7aBupt1UJibA5JqV1IZm/6WmexZ3XcHW1ueKr2gcrpdqqudM wF6wAg+iYY+XvlVRGyrj5Rgc5k9go3g6zDSg6Ihs4BRfUHc6ZHVS9x8ZU+w2vhyeoG7Y R95KDcYstpoitHW0ZcY++k5tnR3zCLm6XND2+pf40ziNe0cLhS1OMf0i6zZJOoM7+JxO z60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=sHt2H3mu; 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 u23si2043271pgv.706.2018.03.14.09.45.32; Wed, 14 Mar 2018 09:45:33 -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=sHt2H3mu; 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 S1752405AbeCNQpS (ORCPT + 28 others); Wed, 14 Mar 2018 12:45:18 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:38080 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150AbeCNQou (ORCPT ); Wed, 14 Mar 2018 12:44:50 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2EGiSdW001049; Thu, 15 Mar 2018 01:44:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2EGiSdW001049 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521045873; bh=uGo9GFfQJW1c2MIT/TgCFg5KX36rVzYNdYKZzcBa5os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHt2H3muOw4OZ0wBFnZfHcrhS2ziv9D1Y5typ4ehDW1ZjR2W9IaKSl8Ol8TU/l/k3 BXkYgWA2++KXrdKwY8RUQSwi1jBH4l5TiTvnHxErcThZqywaeHbPMAaNwckWsDo1L6 MqIJ9zZhLWmUIPqCf2+rlpUBSmnnf+6CBXHYqo5ePLfhOePsyoP8SiK+AnRbuRPPnK SnLwhZrIYdor24Ga6mBA8vk5Bl7UT/X8UDmTqWskBQjAp0B1LdFg4gu8SPpzUmsQ1y kUdzJWi8P+feuup+okm3xytHoIAYhvK2KiMSSrXCVsvGEvZ/ZNTsTjmZrbaSfR9IBN wZImyaTtWtEXw== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Jarod Wilson , Prarit Bhargava , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 7/7] kbuild: link vmlinux just once for CONFIG_TRIM_UNUSED_KSYMS Date: Thu, 15 Mar 2018 01:44:21 +0900 Message-Id: <1521045861-22418-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> References: <1521045861-22418-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_TRIM_UNUSED_KSYMS is enabled and the kernel is built from a pristine state, the vmlinux is linked twice. [1] A user runs "make" [2] First build with empty autoksyms.h [3] adjust_autoksyms.sh updates autoksyms.h and recurses "make vmlinux" --------(begin sub-make)-------- [4] Second build with new autoksyms.h [5] link-vmlinux.sh is invoked because "vmlinux" is missing ---------(end sub-make)--------- [6] link-vmlinux.sh is invoked again despite "vmlinux" is up-to-date. The reason of [6] is probably because Make already decided to update "vmlinux" at the time of [2] because "vmlinux" was missing when Make generated the dependency list. link-vmlinus.sh is costly, so it is better to not run it when unneeded. Split CONFIG_TRIM_UNUSED_KSYMS handling to a dedicated target. The reason of commit 2441e78b1919 ("kbuild: better abstract vmlinux sequential prerequisites") was to cater to CONFIG_BUILD_DOCSRC, but it was later removed by commit 184892925118 ("samples: move blackfin gptimers-example from Documentation"). I also changed adjust_autoksyms.sh to simply exit with 1 or 0 to make it look straightforward. Signed-off-by: Masahiro Yamada --- Makefile | 28 ++++++++++++---------------- scripts/adjust_autoksyms.sh | 3 +-- 2 files changed, 13 insertions(+), 18 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 1dab647..0a7bab6 100644 --- a/Makefile +++ b/Makefile @@ -987,21 +987,11 @@ export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Doc vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) -# Include targets which we want to execute sequentially if the rest of the -# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be -# evaluated more than once. -PHONY += vmlinux_prereq -vmlinux_prereq: $(vmlinux-deps) FORCE -ifdef CONFIG_HEADERS_CHECK - $(Q)$(MAKE) -f $(srctree)/Makefile headers_check -endif -ifdef CONFIG_GDB_SCRIPTS - $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) -endif -ifdef CONFIG_TRIM_UNUSED_KSYMS - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ - "$(MAKE) -f $(srctree)/Makefile vmlinux" -endif +# Recurse until adjust_autoksyms.sh is satisfied +PHONY += autoksyms_recursive +autoksyms_recursive: $(vmlinux-deps) + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh || \ + $(MAKE) -f $(srctree)/Makefile autoksyms_recursive # For the kernel to actually contain only the needed exported symbols, # we have to build modules as well to determine what those symbols are. @@ -1023,7 +1013,13 @@ cmd_link-vmlinux = \ $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) -vmlinux: scripts/link-vmlinux.sh vmlinux_prereq $(vmlinux-deps) FORCE +vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE +ifdef CONFIG_HEADERS_CHECK + $(Q)$(MAKE) -f $(srctree)/Makefile headers_check +endif +ifdef CONFIG_GDB_SCRIPTS + $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) +endif +$(call if_changed,link-vmlinux) # Build samples along the rest of the kernel diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 7bb3618..1377cf8 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -95,8 +95,7 @@ if [ $changed -gt 0 ]; then info "KSYMS" "symbols: before=$old, after=$new, changed=$changed" info "UPD" "$cur_ksyms_file" mv -f "$new_ksyms_file" "$cur_ksyms_file" - # Then trigger a rebuild of affected source files - exec $@ + exit 1 else rm -f "$new_ksyms_file" fi