From patchwork Thu Nov 15 08:27:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151209 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6714591ljp; Thu, 15 Nov 2018 00:29:25 -0800 (PST) X-Google-Smtp-Source: AJdET5flxLFgUReGKZQdEXgfZ67hUMCS83m19V4dXDvm68T+RpijM51/kcMhjs6JPjavFPSabuuD X-Received: by 2002:a17:902:187:: with SMTP id b7-v6mr5367461plb.150.1542270565722; Thu, 15 Nov 2018 00:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270565; cv=none; d=google.com; s=arc-20160816; b=LCnoBlPjGhI5ccht4s8qw7yO+4MeC/XPrQpZCOZ32kbg71DkDssAFp4qfWN0lkUHsH ebRXSJNQjL45ZCh7IcZE2OZcm9CAF6tRIqFtD5TKa/h8oEDvD+8IRWvhMM2g9qthTDpM WgwXJUBxYf+8+Kg7GGtbCnTiNC7wCifgIWZ9qaIeiMRjscSM5bcwGNnn6dkKreQhVB4G EbQME7HF4EeI7/WBvrVIvy+yrIJF+2Au+EMt9e+Ehvc2z/IiwS+5p1XJc3foMQaj9uAq gbwjUTHMbxhIrtgK/UsKMWLhgQqFoZzwKIMRzbz9R6SM79usUdXyetd0aqOwFANgdNAl af1Q== 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; bh=LcE9BN1a5DuG2wOq3e8fyNB+oCKI7v/kfDfDv2Oxnmo=; b=Oza+S0SxEwa9RbR5FCMd7XjJCSHOAVpCsKb46R+egBcwBdd2iquq+1WhS2Ec/knPSE +jjVH+OnFXMBFRKMnQx22pLCeOI1fHM264tI8IXRY2kg4vjLuJ6URUkfdUZvXp/udXaY 3YdwtZjkjeEpfL57S7a7U7fgrTDrvJA1/mmUYQ6mU1UwwtItKDobfUTLclxFsWJEnt3l Yv4P+P0P29gLXMTeVLPEkJG/oZI9v7cPuwXJn7XEbqC9a+4393R7SqWjwf1DF85XCtdX Cq6obQwwy58UcO1MOsS8mW6g2MRiCtTmsJB0Yng+vcQq8hhcZr9L1unRt2B3rN7HG6r3 quCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="1XUlQo/x"; 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 g10si6141559plm.1.2018.11.15.00.29.25; Thu, 15 Nov 2018 00:29:25 -0800 (PST) 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="1XUlQo/x"; 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 S2387531AbeKOSgO (ORCPT + 32 others); Thu, 15 Nov 2018 13:36:14 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:52245 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728519AbeKOSgO (ORCPT ); Thu, 15 Nov 2018 13:36:14 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHoY022794; Thu, 15 Nov 2018 17:27:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHoY022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270440; bh=LcE9BN1a5DuG2wOq3e8fyNB+oCKI7v/kfDfDv2Oxnmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XUlQo/x0kZUUITUMIjno5BW8ae7vqNHV9Bv9MuK8KG7e50dk2WjCjcqs/DGwB77y u8yft67gs28JseS9C/W+YOcE/wfDzJK1jtMlc34eI+G0ouT9T44xkwlLNl4OBdlxtH CxlSI60Ndwk+e30xH1KvdyolSfjAY4+z/pyDA6uOSmQeLpM+mzARIrX30BKzyVOOsv U2/lQJbGfTzGMEs5cYRSebYsKWZZM4IWOHGEI1g2jGiZ7bpBsw7Fv2vvIirR/JHXlM YlXTleUBQdAesuembsyN6N9xI9tjEo8Wfao8r0t0vxjkGgc4X+vAOkBlyW5ZnZXZ6k Cus/pGpNxCD/g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, Michal Marek , Richard Weinberger , Jeff Dike Subject: [PATCH 1/8] kbuild: remove redundant 'set -e' from filechk_* defines Date: Thu, 15 Nov 2018 17:27:08 +0900 Message-Id: <1542270435-11181-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 filechk macro in scripts/Kbuild.include already sets 'set -e'. Signed-off-by: Masahiro Yamada --- arch/um/Makefile | 2 +- scripts/Makefile.lib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/arch/um/Makefile b/arch/um/Makefile index ab1066c..71ff3d0 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -152,7 +152,7 @@ $(HOST_DIR)/um/user-offsets.s: __headers FORCE $(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@ define filechk_gen-asm-offsets - (set -e; \ + ( \ echo "/*"; \ echo " * DO NOT MODIFY."; \ echo " *"; \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 8fe4468..ae3ae97 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -406,7 +406,7 @@ endef # Use filechk to avoid rebuilds when a header changes, but the resulting file # does not define filechk_offsets - (set -e; \ + ( \ echo "#ifndef $2"; \ echo "#define $2"; \ echo "/*"; \ From patchwork Thu Nov 15 08:27:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151203 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6713949ljp; Thu, 15 Nov 2018 00:28:36 -0800 (PST) X-Google-Smtp-Source: AJdET5fTfR3QulKfG27R6H26BzJgHoT5LJl2tHuYRfvFpr+hcfLIpDsD3r3Zupx5CsqemMUOwJDw X-Received: by 2002:a63:6cc7:: with SMTP id h190-v6mr4830451pgc.216.1542270516121; Thu, 15 Nov 2018 00:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270516; cv=none; d=google.com; s=arc-20160816; b=V2BdlPc7BnZcqQcFm1vUp/NQf2+nESUJjiCGGlC2MAnz9xxmoCTyG2KSHbtONg2YYk FzHzE5wm3B+k37Vju7W1RZE2JyeDM4aghyxiC3RKlEti1e74JHqrvdIyRGueC5mVug8B bdOtIMlmvzTP/i65lBu/naEEA94CPBlb87Xykd7SfOqluFcBmaQwccv1kZIY7x49sxUs xvSII0lQ699ftc0zVpqNIDWR/DD7rkQTJrGIi5H5NVCrdexqrBEptawPepK1hUmPWytG pYoEXq2v7+BDA4+jv55DSLM+MeI2EnlhbDxp9hZLnPI90eHillDRuFJdjr7rCsbsKSlD m9dw== 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; bh=oHJWflb/cZj+gpZw6dJRfP6NxNDi/Q4JEPO1Hmc69ik=; b=gnu18HD1Luu7Fd8+PZFU88qooAj4uQKUjCB4E5ZX7thGyXKcp17mvqPMpPSh4xdbxI sqecKDrosSDiWfCs4J8J+jeJA1M/E2ZkwjQb0vbxgUQA1SARS02xJ8AScuispjGyHkwZ hv5uyCjCl0dIWkLlnLeNjVgsB8xRXw+NX2BtLarGPOK4sRtpHBNrAkVMX/E+AlRUKUXU yZDxu8wfPXAbdh0O+SaonEMuWznO0xHU3CwLMNAqmcPYulzGb8HxidzhWLJaGt9QzGJD oRCGO6CS/S+1FfqGkyXMqPiGqfRURocjCeLAeDs+l9MUewFs8EdXv083yhKAKndg1qT+ 7nQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=1WcfUtUG; 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 y3-v6si26159661pfe.42.2018.11.15.00.28.35; Thu, 15 Nov 2018 00:28:36 -0800 (PST) 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=1WcfUtUG; 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 S1729049AbeKOSfY (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:24 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50696 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728757AbeKOSfY (ORCPT ); Thu, 15 Nov 2018 13:35:24 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHoZ022794; Thu, 15 Nov 2018 17:27:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHoZ022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270440; bh=oHJWflb/cZj+gpZw6dJRfP6NxNDi/Q4JEPO1Hmc69ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1WcfUtUG3tWdanxPxKTsV+wD0noBG8LeWj2rsAqOs/MsngujFMc+U8hxxG78pnwTk SjWBuyzN7gHnofENvgDpEe2SpLNK1ETDnLDewIwuhx7jiuQjuCzELR+2M1OQ4DJDw0 AncJs1qWUwsxPr1irmaLtIjdnm72VBKXD1ySNxYM+wUEEBtO3beHuawZ75PnXpBxHr iPvaqEhey5gAOeB9osdbcm8bESzs2+oz2zMArMzbDBKbxvAlPJU0LIGNjP+t9KAlF5 boQKM+Jz9NrXimYmlag4oR2GuXTYEvKdHuhelgkFkKhMqHzzpiTaGroUQGrsnQjfQh XxbifY3kcJ+Sw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/8] kbuild: remove redundant 'set -e' from sub_cmd_record_mcount Date: Thu, 15 Nov 2018 17:27:09 +0900 Message-Id: <1542270435-11181-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 This is run inside the if_changed_rule, which already sets 'set -e'. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index a8e7ba9..7af21a8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -204,7 +204,7 @@ sub_cmd_record_mcount = \ recordmcount_source := $(srctree)/scripts/recordmcount.c \ $(srctree)/scripts/recordmcount.h else -sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ +sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ "$(if $(CONFIG_64BIT),64,32)" \ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \ From patchwork Thu Nov 15 08:27:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151206 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6714025ljp; Thu, 15 Nov 2018 00:28:42 -0800 (PST) X-Google-Smtp-Source: AJdET5cI8nrG6+Qzui7ey9M5S+yIQfMjEsSpIpmvvN4vmUFSf1knTpZKql7NNTFsSvv7gKQ2nets X-Received: by 2002:a65:48c4:: with SMTP id o4mr4782476pgs.371.1542270522513; Thu, 15 Nov 2018 00:28:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270522; cv=none; d=google.com; s=arc-20160816; b=fiYIbokvk5mgwkyr5KdDIk3P4jMHCLY8D6bRvR3VzyrT89MUvKfIeVwkth0I9cNe9W Vir+clAhgGI4xAiORl/cdhmR/Uwlt6huJcNJjH/APgv/UAlIBN0gECNMZakzruIJQ8dO a4Upyw9qZQ46D7zbfPxLiPtM3Sw/J9kaO4+4+3Ikt2N0LaCsa8UQsDZdV415QHdJjr/T OReHZuHvYIfrkPpw8Ku7ZJhcirGmaXhbBZSCT4f6F83uD/nogfFyjilYWND8ydR6b/GJ izrGpwtVieVhWlhMHhZrYNwO2OgdgMjDUvo+7e6r1aLYAI2n/jJ8LB2+9KlcRNX1IaYT 6OQg== 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; bh=PBijk1TstCcY2Qd0zD8K3u/nFfD9XogJ71hEHg31xVw=; b=MVJwmjrhr01fWdYARvIgcYbBpe0uGY1++kVGVT2S6Y+sBX9n3izJZpgGq6PsRYltJQ L4qsSD0Fch8uATZMzo43fsfSLSgQPDRXRbiwOMuZS8/oN0mQIv1JfCrh4oQLpFyRKBI+ f5Iw6YodrlktaJ1X2KB2IccpaNRgmACYg7rgjR9ZFFnHiYPHKcKNMUihhg7FqjBFHFeB 1Z1jSaM7fFnjWAd3f4i2D+rPaVIlRt+hlgINXmi6pGtR7EUCiVtF9AfPlqn472LT7VVV 54XD5dDt2zrwM81gjD8N/7+W+CSTn1+5kkplO19O69nRj5OxlByPVu7pSolyKhgzsCBt AbYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=U3nnIbei; 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 n3si25804568pgk.405.2018.11.15.00.28.42; Thu, 15 Nov 2018 00:28:42 -0800 (PST) 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=U3nnIbei; 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 S1732979AbeKOSfa (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:30 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50851 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728519AbeKOSf3 (ORCPT ); Thu, 15 Nov 2018 13:35:29 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHoa022794; Thu, 15 Nov 2018 17:27:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHoa022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270441; bh=PBijk1TstCcY2Qd0zD8K3u/nFfD9XogJ71hEHg31xVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U3nnIbeiYG0AijrOiIzW3RG2IUid2ktDJz7b2m/0TIl0gyjg4s6rPleaOfI+IGRDZ w33zfwMon9Klr9VXt0UdZgkpBSqirwLpTk850/SMJ9c9mObvcG2L/LOIN5566n/x0C WbjrGMWNETRqoQF73OnD2hAom2csJMxAJ0svpSxAigGvPjVmH5ipCVUTo9loSim3Hp NHZm7XVKOOsPwAIOsNK+mtoKb/+/ejPeJ0U9i8gpGVmvmSDZ91wrO3HdzT64A08yLh VAUKQRvZJAZ1p3g/0SJw79o6Mj5U55rIyGLaavcn3bXlwMGQ5e5lgl64LZocZ/SSIP /idLQlyj41y3g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/8] kbuild: refactor modversions build rules Date: Thu, 15 Nov 2018 17:27:10 +0900 Message-Id: <1542270435-11181-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 Let $(CC) compile objects into normal files *.o instead of .tmp_*.o whether CONFIG_MODVERSIONS is enabled or not. This will help simplify build rules a lot. I guess the reason of using .tmp_*.o for intermediate objects was to avoid leaving incomplete *.o file (, whose timestamp says it is up-to-date) when the genksyms tool failed for some reasons. It no longer matters because any targets are deleted on errors since commit 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special target"). Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 54 ++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 37 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 7af21a8..7f3ca6e 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -154,35 +154,30 @@ $(obj)/%.ll: $(src)/%.c FORCE # (See cmd_cc_o_c + relevant part of rule_cc_o_c) quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ + cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< -ifndef CONFIG_MODVERSIONS -cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< - -else +ifdef CONFIG_MODVERSIONS # When module versioning is enabled the following steps are executed: -# o compile a .tmp_.o from .c -# o if .tmp_.o doesn't contain a __ksymtab version, i.e. does -# not export symbols, we just rename .tmp_.o to .o and -# are done. +# o compile a .o from .c +# o if .o doesn't contain a __ksymtab version, i.e. does +# not export symbols, it's done. # o otherwise, we calculate symbol versions using the good old # genksyms on the preprocessed source and postprocess them in a way # that they are usable as a linker script -# o generate .o from .tmp_.o using the linker to +# o generate .tmp_.o from .o using the linker to # replace the unresolved symbols __crc_exported_symbol with # the actual value of the checksum generated by genksyms - -cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< +# o remove .tmp_.o to .o cmd_modversions_c = \ - if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ + if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \ $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ > $(@D)/.tmp_$(@F:.o=.ver); \ \ - $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ + $(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \ -T $(@D)/.tmp_$(@F:.o=.ver); \ - rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ - else \ mv -f $(@D)/.tmp_$(@F) $@; \ + rm -f $(@D)/.tmp_$(@F:.o=.ver); \ fi; endif @@ -241,19 +236,12 @@ ifneq ($(RETPOLINE_CFLAGS),) endif endif - -ifdef CONFIG_MODVERSIONS -objtool_o = $(@D)/.tmp_$(@F) -else -objtool_o = $(@) -endif - # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file cmd_objtool = $(if $(patsubst y%,, \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ - $(__objtool_obj) $(objtool_args) "$(objtool_o)";) + $(__objtool_obj) $(objtool_args) $@;) objtool_obj = $(if $(patsubst y%,, \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ $(__objtool_obj)) @@ -357,34 +345,26 @@ $(obj)/%.s: $(src)/%.S FORCE $(call if_changed_dep,cpp_s_S) quiet_cmd_as_o_S = AS $(quiet_modtag) $@ + cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< -ifndef CONFIG_MODVERSIONS -cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< - -else +ifdef CONFIG_MODVERSIONS ASM_PROTOTYPES := $(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/asm-prototypes.h) -ifeq ($(ASM_PROTOTYPES),) -cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< - -else +ifneq ($(ASM_PROTOTYPES),) # versioning matches the C process described above, with difference that # we parse asm-prototypes.h C header to get function definitions. -cmd_as_o_S = $(CC) $(a_flags) -c -o $(@D)/.tmp_$(@F) $< - cmd_modversions_S = \ - if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ + if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \ $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ > $(@D)/.tmp_$(@F:.o=.ver); \ \ - $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ + $(LD) $(KBUILD_LDFLAGS) -r -o $(@D)/.tmp_$(@F) $@ \ -T $(@D)/.tmp_$(@F:.o=.ver); \ - rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ - else \ mv -f $(@D)/.tmp_$(@F) $@; \ + rm -f $(@D)/.tmp_$(@F:.o=.ver); \ fi; endif endif From patchwork Thu Nov 15 08:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151208 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6714237ljp; Thu, 15 Nov 2018 00:29:00 -0800 (PST) X-Google-Smtp-Source: AJdET5fHYJ1lQqK/zoxPo3IvoZjEbXG5s0giylqI6dOlXnCVZcM7IArCXqPd4MCphFAxpNRDoKex X-Received: by 2002:a63:741:: with SMTP id 62mr4799064pgh.352.1542270540194; Thu, 15 Nov 2018 00:29:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270540; cv=none; d=google.com; s=arc-20160816; b=bVMH/eQqqrYeHllFM6DTlnUhbmhyajLFQ9qiiFIZwramPqEvBPAkGOOMvUcjq0JO3A 0MIM4PN2rHmu/g1BsRqKtDDr30Fc90x/O3ZM0EYQck0ZzJesB9PZtRs2l2jNiDMyBq0S fus8CpOzsAbiht7VoaLWPMzISlhBfAT6+wsZlUaX8drT8ublN/Q9PnPdtZd9gEXA1Ovn yqY+19EEhM00Iq8zewlcBmrfD781b2Mrl9kwsZZryrSNO9P+TesVQssPq16vMm5jJpuO THHfRxmrHhQx4rEuUsVPGUHkf4j0dqey/oIgaSXLad8A+Hor6Lr40SnxYBO7+ne42cgC ErvA== 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; bh=VoP/6MSzKrT6G19qXrtERXSqectKtW1aiF5e3FyClOs=; b=X6w6I0Z4fZsRsFgusnaWNxabYRf6Nlepg5YsU8XWjvucLy7CsTjn58hHkud/d7H1K2 k2iNKo1WZSEvm4ucYLtnTXn5+WZCK4025lk5JZ0FYZz8lQjXrtTa3KrRoIm+ZwyZaGlW x5CreFKYSUJ5JG+NLyXWGym5hM/NnC9MEK8Tf/WYSRwhuCOsbM35Z8OeobTz0j0HiTSw mJk9sOY6l3raWp0XLI7k2hapB4mwbNiEEG60clAE+g9JW/dj+nZpTtArACOcSRTtJtM7 Wb/gjR/4rXjYO6mn57+FrmufFudmE3eRXVKlTG6RKasyWp9887BIfIoOLBMFeTPoc6ma QuKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=c54iCJN2; 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 d32-v6si28938870pla.405.2018.11.15.00.28.59; Thu, 15 Nov 2018 00:29:00 -0800 (PST) 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=c54iCJN2; 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 S2387482AbeKOSfs (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:48 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:51403 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728519AbeKOSfr (ORCPT ); Thu, 15 Nov 2018 13:35:47 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHob022794; Thu, 15 Nov 2018 17:27:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHob022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270442; bh=VoP/6MSzKrT6G19qXrtERXSqectKtW1aiF5e3FyClOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c54iCJN2oJfFaDjhwWQkTX+MJ72MnsduIPDuHPoqQrcNA50dDZdiW0ODH5FM7cLp3 HmqnR0aHCk9YowV3KuTV9H5ZC1pFL916Yp31vWT0buSipll2G5dXNSyE2X709UvOl4 lrsJJ2WrErRLksQRdsdG1rdPUEfGmuaknZRSd1FFmkXuf11GRp5fQ0lFyZW7cZ7JTG Zh4OCD+7vQTZhyE3TWg+LVGzJ+dIpWMzDEuKuSCAyyZs/xr1rjgACDofHeaNYrNHMT oJPRQe4+Y6PcMqUuvJo5trRU/V3g2d8y562kEnrVQvylvXPvaACuqXrq9SCMy0pVe3 zWpmLwwhCYPZw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , linux-arch@vger.kernel.org, Arnd Bergmann , Michael Ellerman , linux-kernel@vger.kernel.org, Michal Marek , Will Deacon , Ingo Molnar , Ard Biesheuvel Subject: [PATCH 4/8] kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS Date: Thu, 15 Nov 2018 17:27:11 +0900 Message-Id: <1542270435-11181-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 My main motivation of this commit is to clean up scripts/Kbuild.include and scripts/Makefile.build. Currently, CONFIG_TRIM_UNUSED_KSYMS works with a tricky gimmick; possibly exported symbols are detected by letting $(CPP) replace EXPORT_SYMBOL* with a special string '=== __KSYM_*===', which is post-processed by sed, and passed to fixdep. The extra preprocessing is costly, and hacking cmd_and_fixdep is ugly. I came up with a new way to find exported symbols; insert a dummy symbol __ksym_marker_* to each potentially exported symbol. Those dummy symbols are picked up by $(NM), post-processed by sed, then appended to .*.cmd files. I collected the post-process part to a new shell script scripts/gen_ksymdeps.sh for readability. The dummy symbols are put into the .discard.* section so that the linker script rips them off the final vmlinux or modules. A nice side-effect is building with CONFIG_TRIM_UNUSED_KSYMS will be much faster. Signed-off-by: Masahiro Yamada --- include/asm-generic/export.h | 13 ++++++++----- include/linux/export.h | 18 +++++++++--------- scripts/Kbuild.include | 29 ----------------------------- scripts/Makefile.build | 10 ++++++++++ scripts/basic/fixdep.c | 31 ++++--------------------------- scripts/gen_ksymdeps.sh | 25 +++++++++++++++++++++++++ 6 files changed, 56 insertions(+), 70 deletions(-) create mode 100755 scripts/gen_ksymdeps.sh -- 2.7.4 diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h index 4d73e6e..294d6ae 100644 --- a/include/asm-generic/export.h +++ b/include/asm-generic/export.h @@ -59,16 +59,19 @@ __kcrctab_\name: .endm #undef __put -#if defined(__KSYM_DEPS__) - -#define __EXPORT_SYMBOL(sym, val, sec) === __KSYM_##sym === - -#elif defined(CONFIG_TRIM_UNUSED_KSYMS) +#if defined(CONFIG_TRIM_UNUSED_KSYMS) #include #include +.macro __ksym_marker sym + .section ".discard.ksym","a" +__ksym_marker_\sym: + .previous +.endm + #define __EXPORT_SYMBOL(sym, val, sec) \ + __ksym_marker sym; \ __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym)) #define __cond_export_sym(sym, val, sec, conf) \ ___cond_export_sym(sym, val, sec, conf) diff --git a/include/linux/export.h b/include/linux/export.h index ce764a5..0413a3d 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -92,22 +92,22 @@ struct kernel_symbol { */ #define __EXPORT_SYMBOL(sym, sec) -#elif defined(__KSYM_DEPS__) +#elif defined(CONFIG_TRIM_UNUSED_KSYMS) + +#include /* * For fine grained build dependencies, we want to tell the build system * about each possible exported symbol even if they're not actually exported. - * We use a string pattern that is unlikely to be valid code that the build - * system filters out from the preprocessor output (see ksym_dep_filter - * in scripts/Kbuild.include). + * We use a symbol pattern __ksym_marker_ that the build system filters + * from the $(NM) output (see scripts/gen_ksymdep.sh). These symbols are + * discarded in the final link stage. */ -#define __EXPORT_SYMBOL(sym, sec) === __KSYM_##sym === - -#elif defined(CONFIG_TRIM_UNUSED_KSYMS) - -#include +#define __ksym_marker(sym) \ + static int __ksym_marker_##sym[0] __section(".discard.ksym") __used #define __EXPORT_SYMBOL(sym, sec) \ + __ksym_marker(sym); \ __cond_export_sym(sym, sec, __is_defined(__KSYM_##sym)) #define __cond_export_sym(sym, sec, conf) \ ___cond_export_sym(sym, sec, conf) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index bb01555..1eafc85 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -260,41 +260,12 @@ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ @set -e; \ $(cmd_and_fixdep), @:) -ifndef CONFIG_TRIM_UNUSED_KSYMS - cmd_and_fixdep = \ $(echo-cmd) $(cmd_$(1)); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd; -else - -# Filter out exported kernel symbol names from the preprocessor output. -# See also __KSYM_DEPS__ in include/linux/export.h. -# We disable the depfile generation here, so as not to overwrite the existing -# depfile while fixdep is parsing it. -flags_nodeps = $(filter-out -Wp$(comma)-M%, $($(1))) -ksym_dep_filter = \ - case "$(1)" in \ - cc_*_c|cpp_i_c) \ - $(CPP) $(call flags_nodeps,c_flags) -D__KSYM_DEPS__ $< ;; \ - as_*_S|cpp_s_S) \ - $(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 -n 's/^.*=== __KSYM_\(.*\) ===.*$$/_\1/p' - -cmd_and_fixdep = \ - $(echo-cmd) $(cmd_$(1)); \ - $(ksym_dep_filter) | \ - scripts/basic/fixdep -e $(depfile) $@ '$(make-cmd)' \ - > $(dot-target).tmp; \ - rm -f $(depfile); \ - mv -f $(dot-target).tmp $(dot-target).cmd; - -endif - # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, # and if so will execute $(rule_foo). diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 7f3ca6e..e5ba9b1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -254,9 +254,18 @@ objtool_dep = $(objtool_obj) \ $(wildcard include/config/orc/unwinder.h \ include/config/stack/validation.h) +ifdef CONFIG_TRIM_UNUSED_KSYMS +cmd_gen_ksymdeps = \ + $(CONFIG_SHELL) $(srctree)/scripts/gen_ksymdeps.sh $@ > $(dot-target).tmp; \ + cat $(dot-target).tmp >> $(dot-target).cmd; \ + rm -f $(dot-target).tmp; + +endif + define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ $(call cmd_and_fixdep,cc_o_c) \ + $(cmd_gen_ksymdeps) \ $(cmd_checkdoc) \ $(call echo-cmd,objtool) $(cmd_objtool) \ $(cmd_modversions_c) \ @@ -265,6 +274,7 @@ endef define rule_as_o_S $(call cmd_and_fixdep,as_o_S) \ + $(cmd_gen_ksymdeps) \ $(call echo-cmd,objtool) $(cmd_objtool) \ $(cmd_modversions_S) endef diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 850966f3..facbd60 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -105,8 +105,7 @@ static void usage(void) { - fprintf(stderr, "Usage: fixdep [-e] \n"); - fprintf(stderr, " -e insert extra dependencies given on stdin\n"); + fprintf(stderr, "Usage: fixdep \n"); exit(1); } @@ -131,21 +130,6 @@ static void print_dep(const char *m, int slen, const char *dir) printf(".h) \\\n"); } -static void do_extra_deps(void) -{ - char buf[80]; - - while (fgets(buf, sizeof(buf), stdin)) { - int len = strlen(buf); - - if (len < 2 || buf[len - 1] != '\n') { - fprintf(stderr, "fixdep: bad data on stdin\n"); - exit(1); - } - print_dep(buf, len - 1, "include/ksym"); - } -} - struct item { struct item *next; unsigned int len; @@ -293,7 +277,7 @@ static int is_ignored_file(const char *s, int len) * assignments are parsed not only by make, but also by the rather simple * parser in scripts/mod/sumversion.c. */ -static void parse_dep_file(char *m, const char *target, int insert_extra_deps) +static void parse_dep_file(char *m, const char *target) { char *p; int is_last, is_target; @@ -369,9 +353,6 @@ static void parse_dep_file(char *m, const char *target, int insert_extra_deps) exit(1); } - if (insert_extra_deps) - do_extra_deps(); - printf("\n%s: $(deps_%s)\n\n", target, target); printf("$(deps_%s):\n", target); } @@ -379,13 +360,9 @@ static void parse_dep_file(char *m, const char *target, int insert_extra_deps) int main(int argc, char *argv[]) { const char *depfile, *target, *cmdline; - int insert_extra_deps = 0; void *buf; - if (argc == 5 && !strcmp(argv[1], "-e")) { - insert_extra_deps = 1; - argv++; - } else if (argc != 4) + if (argc != 4) usage(); depfile = argv[1]; @@ -395,7 +372,7 @@ int main(int argc, char *argv[]) printf("cmd_%s := %s\n\n", target, cmdline); buf = read_file(depfile); - parse_dep_file(buf, target, insert_extra_deps); + parse_dep_file(buf, target); free(buf); return 0; diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh new file mode 100755 index 0000000..1324986 --- /dev/null +++ b/scripts/gen_ksymdeps.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +set -e + +# List of exported symbols +ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z) + +if [ -z "$ksyms" ]; then + exit 0 +fi + +echo +echo "ksymdeps_$1 := \\" + +for s in $ksyms +do + echo $s | sed -e 's:^_*: $(wildcard include/ksym/:' \ + -e 's:__*:/:g' -e 's/$/.h) \\/' +done + +echo +echo "$1: \$(ksymdeps_$1)" +echo +echo "\$(ksymdeps_$1):" From patchwork Thu Nov 15 08:27:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151207 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6714114ljp; Thu, 15 Nov 2018 00:28:50 -0800 (PST) X-Google-Smtp-Source: AJdET5f9tYp6TFXlQjBJvBt5sKH44J5ijuS6Ifc53JHXCp0dXhHjVp6+3Exob/B9nHuVMX6kWpM+ X-Received: by 2002:a63:f30d:: with SMTP id l13mr4979580pgh.399.1542270530189; Thu, 15 Nov 2018 00:28:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270530; cv=none; d=google.com; s=arc-20160816; b=f8m9YcOy23H4eDLrimiEhg4ANdEy62h7p49udb5h/heTY5BnuXb3TJyIOmj+X70BCN 0KI5m4uO2TNl/C2L5HQy1c0296/LHTQeWfFNsO4TUkhMVvA4ykFG2tf221idgCxEZCnD 7wz6QpMV7wJnRcrDIHFgxY27vk7fdkKzvaqTUPGMXh64dPGycbx2v9y7lgEQkv/hcL/O L3ZwvHGu/GAH9WrSle3iO6D1gJdoJe7nKtkPO5nzhSbmXq2xQD0MBW5DektNn/I2hN/G TkGCT9a37wy2cjZgZ+yletv+6jediMjHn+dCRgAGyrXam75WBS9NNb5rScypZbddm36Z HT4Q== 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; bh=8FrQ1l+FIpNp9mhpnOeiNDDcSQOuKAHj3p0L9t8+oVg=; b=NK87QmhShJz/mquHaPtWet+Y2qf7K2eRyUZNvc68q9PkkcyjvJNUYX1/Hx1ekFx2gM oz1oTsIGjiG0HntV3VXfYEVghitUu3y05Mtxu2UIkEMXE+odftTc4Ih1xQO33W2kcfNK qZAWB40C9EZl67U9Igz1ZviTXohl2ksIbgWrVkiXdtuTXtm3hze4Cw/eobsqT+bjQzhi RYQocSVqniuUlzUn3ZghCClrtyKYHhEBkIfQJNoM5N2upqNIMzH27XnQnOl8JBArkHoe aQb3hHv4ONogniiQfU/+48siHVHihLpbjwTjbj2kvZ8b6/1bRkHsn3gbIYqShEFAuG5G CVMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=N8hNiaRR; 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 y40-v6si27745040pla.391.2018.11.15.00.28.49; Thu, 15 Nov 2018 00:28:50 -0800 (PST) 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=N8hNiaRR; 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 S1729135AbeKOSf1 (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:27 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50789 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729052AbeKOSf1 (ORCPT ); Thu, 15 Nov 2018 13:35:27 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHoc022794; Thu, 15 Nov 2018 17:27:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHoc022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270443; bh=8FrQ1l+FIpNp9mhpnOeiNDDcSQOuKAHj3p0L9t8+oVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8hNiaRRiFBgErdtghyjjslsGX9+bFsMWLq9hawPuWHpGsV4v6kpjLi8eMOyLYBgv iPndDBblwjYqfkJfwREciKByA2i6KKLug405m9j2Gz/iyYPVK/H+BAxzpXDit2TxpS 5efKazUxOgFyN5XztbGe/9sRU1pnRyCm4A5Qq2ePz3JH2E3/oYZtn1dLnIeCADWT0D HwFfNmEjUU13VtyVtXestrIsZoJFeENbMSt8XuETzxvzm4JL/NoZSGdPPUnV2bCBDT TyHuT7lQ4+usgBIgsAr3Ddt4/1JLgItL+9bn1jOHuKtwD5zuiocqBT9K8qLjRsHB0c i/b9I83zIcL8w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 5/8] kbuild: change if_changed_rule to accept multi-line recipe Date: Thu, 15 Nov 2018 17:27:12 +0900 Message-Id: <1542270435-11181-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 GNU Make supports 'define' ... 'endef' directive, which can describe a recipe that consists of multiple lines. For example, all: @echo hello @echo world ... can be written as: define greeting @echo hello @echo world endif all: $(greeting) This is useful to confine a series of shell commands into a single macro, keeping readability. However, if_changed_rule cannot accept multi-line recipe. As you see rule_cc_o_c and rule_as_o_S in scripts/Makefile.build, it must be written like this: define rule_cc_o_c @[action1] ; \ [action2] ; \ [action3] endef This does not actually exploit the benefits of 'define' ... 'endef' form. All shell commands must be concatenated with '; \' so that it looks like a single command from the Makefile point of view. '@' can only appear before the first action. The root cause of this misfortune is the '@set -e;' in if_changed_rule. It is easily solvable by moving '@set -e' to the 'cmd' macro. The combo of $(call echo-cmd,*) $(cmd_*) in rule_cc_o_c and rule_as_o_S were replaced with $(call cmd,*). The tailing back-slashes went away. Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 6 ++---- scripts/Makefile.build | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 1eafc85..5e47bf6 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -215,7 +215,7 @@ echo-cmd = $(if $($(quiet)cmd_$(1)),\ echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) # printing commands -cmd = @$(echo-cmd) $(cmd_$(1)) +cmd = @set -e; $(echo-cmd) $(cmd_$(1)) # Add $(obj)/ for paths that are not absolute objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) @@ -269,9 +269,7 @@ cmd_and_fixdep = \ # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, # and if so will execute $(rule_foo). -if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ - @set -e; \ - $(rule_$(1)), @:) +if_changed_rule = $(if $(strip $(any-prereq) $(arg-check)), $(rule_$(1)), @:) ### # why - tell why a target got built diff --git a/scripts/Makefile.build b/scripts/Makefile.build index e5ba9b1..5528a6a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -263,20 +263,20 @@ cmd_gen_ksymdeps = \ endif define rule_cc_o_c - $(call echo-cmd,checksrc) $(cmd_checksrc) \ - $(call cmd_and_fixdep,cc_o_c) \ - $(cmd_gen_ksymdeps) \ - $(cmd_checkdoc) \ - $(call echo-cmd,objtool) $(cmd_objtool) \ - $(cmd_modversions_c) \ - $(call echo-cmd,record_mcount) $(cmd_record_mcount) + $(call cmd,checksrc) + @$(call cmd_and_fixdep,cc_o_c) + $(call cmd,gen_ksymdeps) + $(call cmd,checkdoc) + $(call cmd,objtool) + $(call cmd,modversions_c) + $(call cmd,record_mcount) endef define rule_as_o_S - $(call cmd_and_fixdep,as_o_S) \ - $(cmd_gen_ksymdeps) \ - $(call echo-cmd,objtool) $(cmd_objtool) \ - $(cmd_modversions_S) + @$(call cmd_and_fixdep,as_o_S) + $(call cmd,gen_ksymdeps) + $(call cmd,objtool) + $(call cmd,modversions_S) endef # List module undefined symbols (or empty line if not enabled) From patchwork Thu Nov 15 08:27:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151204 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6713982ljp; Thu, 15 Nov 2018 00:28:39 -0800 (PST) X-Google-Smtp-Source: AJdET5dMVhgYwxh6syoEMoNzcybwtTr3kZVM++lSzB3jnq612pR3Z7YU5ZxjKjnbJ+eSgwEAwUoc X-Received: by 2002:a62:5dd1:: with SMTP id n78mr5408597pfj.58.1542270518936; Thu, 15 Nov 2018 00:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270518; cv=none; d=google.com; s=arc-20160816; b=W1oEq3iPRUmUNLOIt9j2n2moh86I48i3vCvUNbnmWR64HZikJJh91b0npWfPYwZ3To Nat/7hjrdHDfA62EqHVaI98LZJlrA+fHlKAF0J2olOnLmqAfictPmouysZR3J+4tgrMM te9xv5D9pD2WG7NnUm+LYiW78Z3bgVr+OSPd0Fn2cPvz9y7J4XNn7gN3Rjv7qFxB0RgS ZncFb9wEWZgkH+hYXsvNJX4Fqt7VqMFjEUWl5yXBbMioL8Lapgero0k7YHDZn4B4Kj/c 7coZnhFfWAJqKUPwIxVLg4TlOCx8V+dY9XUgiAYoxuXb7o/pTxhPoFAVC5J/u1E/31jm fFNg== 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; bh=o1GWGIaipR/X6q6oCdm15fafbmJ3OCU4vDv1Nw3MR5k=; b=FyB4pH+af2F3tWtyKrqVQBkfwqejDTXgwhToLUgjHEitp/kIu6Kz3GorYknsqfCnk/ PpZhY8K3YUjVhpyHbuZ5MV6pfxH6iTMXNwIXWx9nTzLIivpJBFmu0H8ABLVX/txf7kGu e8TI6H9a+VStdQa/yDFFLepn26iwp9848KSA844CQDL/XfvhhMSvfxr8ccv42XitPKLz qBr3Y2ncDIZaJFjunaL0+aMjjIQF41RyBm1CeRC97TZxHDal8AfCc6mua1FrIRo9W979 4nL71nNj0/+k6u54yYkRAavypwPwmYJDM/Cd1waNfoTvYGft9ZHORI28Z/OrLGXWyWAS RtHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VDKyVGxd; 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 w16si26637014pga.328.2018.11.15.00.28.38; Thu, 15 Nov 2018 00:28:38 -0800 (PST) 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=VDKyVGxd; 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 S1729097AbeKOSf0 (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:26 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50702 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728519AbeKOSfY (ORCPT ); Thu, 15 Nov 2018 13:35:24 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHod022794; Thu, 15 Nov 2018 17:27:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHod022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270443; bh=o1GWGIaipR/X6q6oCdm15fafbmJ3OCU4vDv1Nw3MR5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDKyVGxdLyw9eym5gQaPCvZTugbjMOXG4XeNgDYiFQjR4lrROBUvlhfwUHAymFKwu qI/uYoxSKnceoGrLsbi2raUr3pSwQzfjtWbFOVC620ytnZNTvDReuewJsZlVS7BXni WJari73F6Mr3xOEcHfSC7XDwmibmnJwSlmW4qp5TWiOkoKyWNNpJ/IIXp3tlRWv4Ab SqhjjiqS7aP51Gkbwb6ZeM4xpEaYY9/2y7zzlp7EdC2TFq3VrGKainvvuyoKyP27qR KCUIlNaxCB8IdYG9YcRbmFAcrDUTOsU9tlH2cTJ0Iq93Sv4odw5PgLoPvh4mAsNlGI K+HYGu3opazHA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 6/8] kbuild: remove trailing semicolon from cmd_* passed to if_changed_rule Date: Thu, 15 Nov 2018 17:27:13 +0900 Message-Id: <1542270435-11181-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 All commands passed into rule_cc_o_c / rule_as_o_S needed to end with a semicolon because the old if_changed_rule implementation only accepted a single shell command. To pass in multiple shell commands, they must be concatenated with '; \'. With the if_changed_rule change in the last commit, this restriction does not exist any more. Rip off unneeded semicolons. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5528a6a..78e647f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -75,14 +75,14 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ # Linus' kernel sanity checking tool ifeq ($(KBUILD_CHECKSRC),1) quiet_cmd_checksrc = CHECK $< - cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< else ifeq ($(KBUILD_CHECKSRC),2) quiet_cmd_force_checksrc = CHECK $< - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< endif ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),) - cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< ; + cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< endif # Do section mismatch analysis for each module/built-in.a @@ -178,7 +178,7 @@ cmd_modversions_c = \ -T $(@D)/.tmp_$(@F:.o=.ver); \ mv -f $(@D)/.tmp_$(@F) $@; \ rm -f $(@D)/.tmp_$(@F:.o=.ver); \ - fi; + fi endif ifdef CONFIG_FTRACE_MCOUNT_RECORD @@ -211,7 +211,7 @@ cmd_record_mcount = \ if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \ "$(CC_FLAGS_FTRACE)" ]; then \ $(sub_cmd_record_mcount) \ - fi; + fi endif # CC_USING_RECORD_MCOUNT endif # CONFIG_FTRACE_MCOUNT_RECORD @@ -241,7 +241,7 @@ endif # 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file cmd_objtool = $(if $(patsubst y%,, \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ - $(__objtool_obj) $(objtool_args) $@;) + $(__objtool_obj) $(objtool_args) $@) objtool_obj = $(if $(patsubst y%,, \ $(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \ $(__objtool_obj)) @@ -258,7 +258,7 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS cmd_gen_ksymdeps = \ $(CONFIG_SHELL) $(srctree)/scripts/gen_ksymdeps.sh $@ > $(dot-target).tmp; \ cat $(dot-target).tmp >> $(dot-target).cmd; \ - rm -f $(dot-target).tmp; + rm -f $(dot-target).tmp endif @@ -375,7 +375,7 @@ cmd_modversions_S = \ -T $(@D)/.tmp_$(@F:.o=.ver); \ mv -f $(@D)/.tmp_$(@F) $@; \ rm -f $(@D)/.tmp_$(@F:.o=.ver); \ - fi; + fi endif endif From patchwork Thu Nov 15 08:27:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151205 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6714002ljp; Thu, 15 Nov 2018 00:28:40 -0800 (PST) X-Google-Smtp-Source: AJdET5fgo1XeoBQmNBZBPyT4faUsx+Q30WOEK53uveXnYDxIk5SnzifVNtRSHUedR7Mfa79cfsEj X-Received: by 2002:a63:594d:: with SMTP id j13mr4949989pgm.210.1542270520359; Thu, 15 Nov 2018 00:28:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270520; cv=none; d=google.com; s=arc-20160816; b=Qknc3XRciAloOjtq/KKiVB9CkcNb/vyAGWdpSf0RRktdsj9piB1QVzr/E+xYK4D2LI o5svYr9eINKvTgVFC/l9Bv8GnaWNcn7dhiXGi843BkT8Nx3UqufCSeZnBab3S0l7sY6T gyVxyovdqKrs/NCyiBcbH+hiVmoO1m4T1KXmspJ98FFFGI39wXZUJqwptlWWjvjOJcLI e/6iMLt2WmzRWr+vcCBmQmX2QZ3RdpFIPOShDxnO/GFqMAL2tcffXOBIOxL6CwgsIMy9 xXI6COiLPLRb1smWBHFZ8fCOpbv3/N8aGF+Wrg65EvR98GLJPeIzv2hkHza5/DCoWD7Y R1zA== 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; bh=c8ZdXLBNCXHefDwQ/cCwID3DrPEA1GhMAWsKRg379ak=; b=rBOEPPMfxvPpSo7Fiu9RTiDiD56YrtJBzmNHuOO1AVxL1xlJunWpwMtMstHI6V89Ce 0HLMhFci4v0ONfS0ycwDpOmx/6PVYwqKj9TYgMZVN0F1e/PKF2HyJISVEmFFo+hIQ23o yaOp1zGYxDXjXah/nWONPPuaWFSBu+wAfbKX/MVA6mXzBLKaC7DO99+Cra9IBW+P/k9z v/SsauTa7e4w/O5gmRLJKTkM/skFf5CoHuTQevCGBZbNTK9e3DVQ0crXYTQWLwy+Xp1B givyaq/5/GmGXyHU+tR1BKfCRWO90CYTbK94XrdAFbtelzHONzbGAb04YcZZw/QsyTyU gOkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="1n/fyluE"; 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 f5-v6si5488509pfn.85.2018.11.15.00.28.40; Thu, 15 Nov 2018 00:28:40 -0800 (PST) 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="1n/fyluE"; 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 S1732588AbeKOSf2 (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:28 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50788 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728757AbeKOSf1 (ORCPT ); Thu, 15 Nov 2018 13:35:27 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHoe022794; Thu, 15 Nov 2018 17:27:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHoe022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270444; bh=c8ZdXLBNCXHefDwQ/cCwID3DrPEA1GhMAWsKRg379ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1n/fyluEv1Jy+qDU2a1EdK7oFAh96OhBAlXu5p2U14kXiZfLHGT3vxhdIicbD26ot Qf2lDPdW1jxq13zIxIAx5GUrtj/rSWxMoLc4ZVy4w1PjUmcgCYPshEhzZHtRROkscX ooWK0iHP/SobPz5si+KnCUDNOLiZd0V7h40xmN2a9/Mv8a1gAaCLkjbYWwSpR10g/a LiYbuomoLO90zs9FLlJt2Bf8J2HFlBaVQ2Zsjiy+VjV4d2cdBa3aIshVSxKaRM4J6v YvKR9gyr4M+EJNkUOCY2ZrEkcLbHh9KOlLBcy0KK0RlpsOuy7GZneT2/mLLQXIkmt0 9xum95VKXKZig== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 7/8] kbuild: refactor if_changed and if_changed_dep Date: Thu, 15 Nov 2018 17:27:14 +0900 Message-Id: <1542270435-11181-8-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 '@set -e; $(echo-cmd) $(cmd_$(1)' can be replaced with '$(cmd)'. More cleanups. Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 9 +++------ scripts/Makefile.build | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 5e47bf6..e4b77ef7 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -251,17 +251,14 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) # Execute command if command has changed or prerequisite(s) are updated. if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ - @set -e; \ - $(echo-cmd) $(cmd_$(1)); \ + $(cmd); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # Execute the command and also postprocess generated .d dependencies file. -if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ - @set -e; \ - $(cmd_and_fixdep), @:) +if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)), $(cmd_and_fixdep), @:) cmd_and_fixdep = \ - $(echo-cmd) $(cmd_$(1)); \ + $(cmd); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd; diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 78e647f..0f28df2 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -264,7 +264,7 @@ endif define rule_cc_o_c $(call cmd,checksrc) - @$(call cmd_and_fixdep,cc_o_c) + $(call cmd_and_fixdep,cc_o_c) $(call cmd,gen_ksymdeps) $(call cmd,checkdoc) $(call cmd,objtool) @@ -273,7 +273,7 @@ define rule_cc_o_c endef define rule_as_o_S - @$(call cmd_and_fixdep,as_o_S) + $(call cmd_and_fixdep,as_o_S) $(call cmd,gen_ksymdeps) $(call cmd,objtool) $(call cmd,modversions_S) From patchwork Thu Nov 15 08:27: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: 151202 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6713943ljp; Thu, 15 Nov 2018 00:28:35 -0800 (PST) X-Google-Smtp-Source: AJdET5fMCcfbpnh1pMDFW7bsshNL9WyjN3i8m2IBGO+yAH1HPGBsRD+HCp/2qXAvRAuSIUXwXjme X-Received: by 2002:a62:6547:: with SMTP id z68-v6mr5317925pfb.169.1542270515709; Thu, 15 Nov 2018 00:28:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542270515; cv=none; d=google.com; s=arc-20160816; b=I9AdKeNk5A8mzxJ+IXXESaSQar/XJwvHpwvcxAIkcLG7JQuKHmQ79kJFNUOe8xGgjU 5hd/Lx4Cr3XeQtSd0nuJiDtZPPeEMBBCksjKXlI9UH0U3eZeybMITqN+fkxcLaUJv7Cw EjxAaI2LLE8s8sASzvHOfK6AIpsWKwemnVwDga9slEEP5Or4Bdu4beW1WS24JWQx89Hq xDeYJCN5zmCPsu1RQASJRiiu/2EGmmczsdzkrsHI+6iojRVLvR2U4JIgj2N0lJ5VXlqW f6+63f870dXheaaCLmfMeCfG4wp70BqXCT0EAVYR0nl2Ulevq8wWVOMHOK1Mf/58IlFY +l8w== 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; bh=DnGgUS0hhg+x1SY/xfxll6SbL2Lqbmk3WkFzwR2jry8=; b=eeDlUGL8gte1zzE+BU+2CJMuIoaI+9K1eBJkY8LziZzgl7FIVTo1D5dTgeum+vWvbb PbQIKd1HLeNOWLhS4ltIM1swGMZb5czYJKdhAjZKks4K1qUUEGdPdSWgjUxIAYmyAOnR B8Tj53Nr3siVZtG2iI5LAvmWMZZv4yuUmCSUBSkKBm34dTYXOkBrvs13W2pV1gWXDr9F ZNuRVRLaUEIR6rGRaXN5WBQ8s32GQNxd8j5SvVSPDQfSzpT95PK7oIuwZmqeD6k9d0GP qji/iTHkCzzbIbrT9727Z4jVTKviNUx5xrKKpAMpJnwAQ2KSrgyVsucL2CpxbUCF7RgV 2a/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=L7rqx2ZS; 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 y3-v6si26159661pfe.42.2018.11.15.00.28.35; Thu, 15 Nov 2018 00:28:35 -0800 (PST) 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=L7rqx2ZS; 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 S1728991AbeKOSfX (ORCPT + 32 others); Thu, 15 Nov 2018 13:35:23 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:50699 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728564AbeKOSfX (ORCPT ); Thu, 15 Nov 2018 13:35:23 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAF8RHof022794; Thu, 15 Nov 2018 17:27:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAF8RHof022794 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542270445; bh=DnGgUS0hhg+x1SY/xfxll6SbL2Lqbmk3WkFzwR2jry8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7rqx2ZS6V0DNS+uB7DyfJv3kfc1SQ4bigwyicQgfbYpJvBlIA/Uoljp7yBdPeeTO 5VmYTeuAcrRgKoPkmkM6ZTTEoGOwDG5+1mecng/bAsPmURhbgYXY84+VM/53IIVH3r EPJaUKRNnfGPcFBkV9WGkUCWPJyabs7AllWmyY6cHwOKszbs8Grt6Iz09jm+3MGfj4 fWYgGMfESUneB7wSMAuHsBLlSFRcf7AYkTu7enF8TFvSbP7RxZES0WiCWZ/W+paMu4 Szi0Shk28l9NWHsKXOJFmb2xt+JiyaytNfrnbFQip/aIsrfgAmnFmG3+V/+8V5v4MR b1w/VrXgVnygw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Rasmus Villemoes , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 8/8] kbuild: remove redundant 'set -e' from cmd_* defines Date: Thu, 15 Nov 2018 17:27:15 +0900 Message-Id: <1542270435-11181-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542270435-11181-1-git-send-email-yamada.masahiro@socionext.com> References: <1542270435-11181-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 These three cmd_* are invoked in the $(call cmd,*) form. Now that 'set -e' moved to the 'cmd' macro, they do not need to explicitly give 'set -e'. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 2 -- scripts/package/Makefile | 1 - 2 files changed, 3 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0f28df2..0bb8d9a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -134,7 +134,6 @@ cmd_gensymtypes_c = \ quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ cmd_cc_symtypes_c = \ - set -e; \ $(call cmd_gensymtypes_c,true,$@) >/dev/null; \ test -s $@ || rm -f $@ @@ -340,7 +339,6 @@ cmd_gensymtypes_S = \ quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@ cmd_cc_symtypes_S = \ - set -e; \ $(call cmd_gensymtypes_S,true,$@) >/dev/null; \ test -s $@ || rm -f $@ diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 73503eb..453fece 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -33,7 +33,6 @@ MKSPEC := $(srctree)/scripts/package/mkspec quiet_cmd_src_tar = TAR $(2).tar.gz cmd_src_tar = \ -set -e; \ if test "$(objtree)" != "$(srctree)"; then \ echo >&2; \ echo >&2 " ERROR:"; \