From patchwork Tue Aug 6 10:03:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170652 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5474170ile; Tue, 6 Aug 2019 03:03:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJcRAYhXeAyc6qI5BqrflkpDzSJH/e7+ku1QE3rOdOz9h7FwJBHW65eL27H6PvsyUqDTtk X-Received: by 2002:a63:4522:: with SMTP id s34mr2292837pga.362.1565085828153; Tue, 06 Aug 2019 03:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565085828; cv=none; d=google.com; s=arc-20160816; b=PTTebHddOy6tMWzYLHc2tdzXeoImnavypksS4WR2wv6Njc4Z/KAnOXoWCX2rlaT+MZ g3gUekR0GX+Eij9TjqyRpaapkGb1aPE2gMxoUxKCXQk9Ab0sLRDzjtu6M7B6m286uA1Q e63vOO7iLEiHSUvBEvC6ol3pJ1F1WtJvNF6c+aQpaY/RcjdLgpOU/F4b9y8o4COsxXeq eDkG5xvCjN3KZN6Sz8otVfsucjn2xsC4bD/qzF7BHWfaA6yDRUbUYfxq4XvKjsetd9Gg 7lddNBkD2e8L+Ma75rm2nqPDHjRi8uaZUsaVZMFsIRQRMa+Px3ORvmusmLJ/N6L+XYAs iQSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=9NrW6qBmvdU9uW3rAgNep8F0eSYArnBcMnQhTyTwaww=; b=AVhOftUuBI5snAeov90x3WEGr6RN+Em+6yltRBaBtxv1ksb9aozXIkwZErXQoIhJu5 XGfdDq/Uz+zezgDkeXMq9lfQfdhclpG1/3p3Cqx4o/P5RReKH8Herl+D1Ko5kOhwTmNP 5ag800RuBVkC7GHBdGvAhgukCqoFGJ+Xz9XogkpxtmeQQxiemUMWHhX9P5motRivXo5x ciLg7QSbFedXr2HKBlc2CgQXWuktE0zLdj/Zkm86lMqm0HtQho4O3sQJEEcaCyMWD9UB Dv5BugtUb3e+J6WzJFTjPW8Ap7aOJC65e2rG9ZZbJ8aELo3e0xGWDfxsCbzYRIooRHO2 8dWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=MkzGE5LO; 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 i64si47502798pge.307.2019.08.06.03.03.47; Tue, 06 Aug 2019 03:03:48 -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=MkzGE5LO; 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 S1732616AbfHFKDr (ORCPT + 29 others); Tue, 6 Aug 2019 06:03:47 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:35239 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732543AbfHFKDq (ORCPT ); Tue, 6 Aug 2019 06:03:46 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x76A3QP5032264; Tue, 6 Aug 2019 19:03:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x76A3QP5032264 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565085806; bh=9NrW6qBmvdU9uW3rAgNep8F0eSYArnBcMnQhTyTwaww=; h=From:To:Cc:Subject:Date:From; b=MkzGE5LOFyAkFM/mazFokb44Dff7O4BkvljryLLL7l3iGqerSvHAkC2yBhCbFbXhx iMOamayOTdszFXjVfyoF9WHSAHB1N9aTN/AB7BJRFAmcLveYUt7bv7Fh0erLeO8ajv QJ+7E62gIf4ye3TKPDEkOMLjpOxq9uvfsUrXPm6wNuenjGpYSkLLrMkOIZcXRRJfpW xTnPKmuUPOzwYSjCgMx3eGYjB3xGiFM4BPoWbLaN5gprcot7Q2EOF31j3VgXXWnAhA vbJuWHkFw3P3xf7fD5Yg2dyRsz3SJblEnBERuFEWqnBi7RIf1pf1yQIfJ00DY8AE2K dvzV4ebBlzk2Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jan Kiszka , Tom Stonecypher , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH 1/3] kbuild: fix false-positive need-builtin Date: Tue, 6 Aug 2019 19:03:21 +0900 Message-Id: <20190806100323.22919-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current implementation of need-builtin is false-positive, for example, in the following Makefile: obj-m := foo/ obj-y := foo/bar/ ..., where foo/built-in.a is not required. Fixes: f7adc3124da0 ("kbuild: create built-in.o automatically if parent directory wants it") Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0d434d0afc0b..3fe0c73e002c 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -487,7 +487,8 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \ PHONY += $(subdir-ym) $(subdir-ym): - $(Q)$(MAKE) $(build)=$@ need-builtin=$(if $(findstring $@,$(subdir-obj-y)),1) + $(Q)$(MAKE) $(build)=$@ \ + need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- From patchwork Tue Aug 6 10:03:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170654 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5474480ile; Tue, 6 Aug 2019 03:04:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNm+mWpSj4sO41fAUgS6sgDTpG4zNsYLJWtUaIKSJrCBKPJSnCwjIWOaNDxqoxx8J7k78Y X-Received: by 2002:a65:518a:: with SMTP id h10mr2268316pgq.117.1565085841727; Tue, 06 Aug 2019 03:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565085841; cv=none; d=google.com; s=arc-20160816; b=DYjtcRZrSEglbfLtWwePykBAr1xU350EcxMteHFHi3XPzENDh3VFS4B/hvAASphKWy OlTrEKkHsAa+lFJkFGlhwqaeg4mnr8z2m+IfXAFp9hwvekExMdA7jg2Awqay31jyK0zP xUM6+Dh1FxeFWeN0lUU3WUANHUbXp4BaM7EfDmN+miMEMpO3wRgn85zVAAbfejBXQGQl V2ZjmzIuTwwUu7WDLnCqgdyPe4RgXOt85R4eyqh1GRqemPbr2iFO/2o6RVVUnE223Lor LGjBbNUVa+7+j7hroztUZqHL6ZWN+iBlDVBG8NVB2HbaQmp+Y/lJL7jNmJ6wCwrFgjk0 8OJA== 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=hqrexllHfLZTAkJJn6Gw3NY0h4befaHZw0q0NAO9avI=; b=gpgmWcnammorVGoSzVrCc99pynXPVwgy3E8qS56hbpLtz/oQ0/6bCBP/FZL1sFAwwJ EVsL+jVAzTaIsEb3Q2cLX0YOu4GaXbcfr0HEPWRE92TR5v16f/KYvSr/dQNRGJN0Oz1U 9dOC6FemCRcmO2tePpJpEt84pPofOjS592+pF/hoMA4O4sommaT4znaR8E+oRDxpepTV Pn1OZBVduFZbFPikaoUy+PJ5YWWBofDdNclm4eGrKgGpg2VOXfpbWSyY9OTDKqmUY5HB Gk6fpPs5KJpbNhfLnXEvV+NwjcX5Mp6hzCu7IkEPpiMVJoTdJhjNbyNq/ZY6maYA22I6 9aOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=mkb1F4nT; 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 z26si46262701pgl.562.2019.08.06.03.04.01; Tue, 06 Aug 2019 03:04:01 -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=mkb1F4nT; 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 S1732731AbfHFKEA (ORCPT + 29 others); Tue, 6 Aug 2019 06:04:00 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:35533 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732584AbfHFKD6 (ORCPT ); Tue, 6 Aug 2019 06:03:58 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x76A3QP6032264; Tue, 6 Aug 2019 19:03:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x76A3QP6032264 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565085807; bh=hqrexllHfLZTAkJJn6Gw3NY0h4befaHZw0q0NAO9avI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mkb1F4nTNsDMbt5jCGEYav0ufh9ooFndRQLs3DeFxQbPRzQT3R7QeZXB5q+tAVi8g UVTHRRvR6fE5617epVKueSGkKKO7kcDi4c4uHzKH+5W8Z4b/ACBIP9StpIsTjewyoN SGJ0HWCy6q7faVRDVH88uD+aH+1kA8kkeF/crWUZctBTHTm4ixp30miVLnyNEJ2KPR kurpyioaRYJ6IrYUV8TLiEl2X+lpi3Grh0isGNKMMtANi+DSUZQlGAqXZIXnS17EEQ zk39qweoc69ntZmQbR0yQnGfYJVL7I9D6+dauY+aDXALbvTQAcDzuPAw2Lytm2lJmi IX4R6nJL8zVHw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jan Kiszka , Tom Stonecypher , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH 2/3] kbuild: generate modules.order only in directories visited by obj-y/m Date: Tue, 6 Aug 2019 19:03:22 +0900 Message-Id: <20190806100323.22919-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806100323.22919-1-yamada.masahiro@socionext.com> References: <20190806100323.22919-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The modules.order files in directories visited by the chain of obj-y or obj-m are merged to the upper-level ones, and become parts of the top-level modules.order. On the other hand, there is no need to generate modules.order in directories visited by subdir-y or subdir-m. They would become orphan anyway. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 3fe0c73e002c..37a1d2cd49d4 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -488,7 +488,8 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \ PHONY += $(subdir-ym) $(subdir-ym): $(Q)$(MAKE) $(build)=$@ \ - need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) + need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) \ + need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1)) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- From patchwork Tue Aug 6 10:03:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170653 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5474224ile; Tue, 6 Aug 2019 03:03:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnqIyGETWPbbxeKLaw23jc8gSh5G0asXz3aCptHOlOTc7NTlQ+Jp2hDp3qEvbK7TzOYeR0 X-Received: by 2002:a17:902:c509:: with SMTP id o9mr2434680plx.222.1565085830110; Tue, 06 Aug 2019 03:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565085830; cv=none; d=google.com; s=arc-20160816; b=aaenGMRSSxwPiuH+H/2L+UWD4p/yrWjPDRIFTef0UqGdvV3PylCK4zZlHn2fU3AEQO A7I2fQhVtPLBEbrBnvRwfPpMQT3rz3tG/AMuwR9bWMuOgdi3dEYx7Sq4Ixo37NwgNU2B K3wZ+YaB9HdhwOzO1wOXpDbeaOsn0NdxPDVy6dnJm27Xvhots4ZUu74TmchjXrMdMbzn SGih6pvVT9v0ooi18MjzxdVpPTc6otbhgT05HT3XoY/dxd1gpjUzZr1flmi5n4GU8DHx 1V17qR/rSS2fUBay3CVPthjQhn6evDcRBCefX5nZ3a3uCs/vSZ/p7MH7K9cJh8f7kKhS F+Lg== 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=c5fIC9D2pNQf5m9q0GW5G7kSjp5FlUSpKAcjOG6gNXc=; b=tqeHv6JM0khoRJxg+nnineqKx6YPNSSk9veFFbYm5kl8yf0ozdMxR/1aRAbmb9cFiN kZHfDFAau8XzWIcpMq08XXQ/ZeMqYHvuUaRvdpEM8rkdl41O+np6v6UX7TwWIK+Dpb3V cvin+PNadWCMAuKSZgWL1hOW1eXIrnMJMojNMb29faCqSGrGqv9ZEErymz9/tvU8pX8s jCuVsU9fU2ul0J3N8eaNmOofarytn8e+DWvuBLHL3lnmfKMgBGDHGmI8ur0pC0fn4BA2 9srSd9CnHDNZx6FeTzvVbjEE9Lv3eYtJi9NiDQ9L5MA1HV7gLEuHVP17QM3n6cndpBoN RlBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=SdX9hynW; 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 c7si48818651pfi.253.2019.08.06.03.03.49; Tue, 06 Aug 2019 03:03:50 -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=SdX9hynW; 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 S1732641AbfHFKDs (ORCPT + 29 others); Tue, 6 Aug 2019 06:03:48 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:35238 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732584AbfHFKDr (ORCPT ); Tue, 6 Aug 2019 06:03:47 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x76A3QP7032264; Tue, 6 Aug 2019 19:03:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x76A3QP7032264 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565085808; bh=c5fIC9D2pNQf5m9q0GW5G7kSjp5FlUSpKAcjOG6gNXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SdX9hynWeliTkext6GKcbrRieTQFfibJfmOEdViGw11tEj+aU1Up6XQ5qGBAF8DJ6 HlRbt+0fzYZJ5O6oK0FHAc3i6QsUKxkPfsIy/c74aW4HmfGcsb+2j3tIJ3nFb9fcF1 /CEQnOruSqdONzS8CoaZ6whCteVkSdLz0jMHawlPIB9Owu9zdfc/zDbMSRQ1+jTwId Lwpp1JQ8EbjkxwM7peDdRuB8UTplVVblIjrRNejV/53F4Qxw/Ri5lSWq1PKcnk1gDn ps/caWOsejL1DQ1WyY5a7wGc2QapkO2+sHjhNZQ+MaeN0oR18/PpVPEYW2HNxWJa+q Wf0TNLJgf8Jdg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jan Kiszka , Tom Stonecypher , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH 3/3] kbuild: show hint if subdir-y/m is used to visit module Makefile Date: Tue, 6 Aug 2019 19:03:23 +0900 Message-Id: <20190806100323.22919-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806100323.22919-1-yamada.masahiro@socionext.com> References: <20190806100323.22919-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod"), a module is no longer built in the following pattern: [Makefile] subdir-y := some-module [some-module/Makefile] obj-m := some-module.o You cannot write Makefile this way in upstream because modules.order is not correctly generated. subdir-y is used to descend to a sub-directory that builds tools, device trees, etc. For external modules, the modules order does not matter. So, the Makefile above was known to work. I believe the Makefile should be re-written as follows: [Makefile] obj-m := some-module/ [some-module/Makefile] obj-m := some-module.o However, people will have no idea if their Makefile suddenly stops working. In fact, I received questions from multiple people. Show a warning if obj-m is specified in a Makefile visited by subdir-y or subdir-m. Cc: Jan Kiszka Cc: Tom Stonecypher Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 37a1d2cd49d4..4a26c7ed9198 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -52,6 +52,13 @@ ifndef obj $(warning kbuild: Makefile.build is included improperly) endif +ifeq ($(need-modorder),) +ifneq ($(obj-m),) +$(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.) +$(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.) +endif +endif + # =========================================================================== ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)