From patchwork Thu Jul 25 15:06:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 169722 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp11765748ilk; Thu, 25 Jul 2019 08:07:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5dB/JOHjQBbSwXGsT2NIV6XOPkZf88MYNiEhaf8Jq0lgy221sPjfign44fxdYen0ZtS4O X-Received: by 2002:a63:460c:: with SMTP id t12mr86137719pga.69.1564067263271; Thu, 25 Jul 2019 08:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564067263; cv=none; d=google.com; s=arc-20160816; b=p9rl+96L2dBNLRoLHdvzsc0L9ms8/jTANqKMWgXDgs7ANJ91EzqD0QOR2EpQQF8wxU b6BPEMgxIcI/RH0QEWEcFbI1B18+0eF2y2+uFeJqEvR4xt021Z8+3WUPtfbg+uptxaZh qJXLhf4jKJYKEDep90HFT3nomox5L6G3jsVTN3W2ebnf7hu+WXc2wIAbM11PLdTYtOX8 lNqxt/orNsIS6ideuQH/nk0+oPZ/FQsDG5yRldt708Otki6eHuTi6lDh5VVmBoyggPXJ rnW6WooVln141OiU095hrRw0pfOjCHKlIMoD1b6jQvupz3fHkCnaPRvedyQrInopph0z 3toA== 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=XVd6xCB986FgI4lziNdiIUd8DbxIxrs0iKDny4AAdqY=; b=HzR7APofDkhPKvuqRqWc2WSOzrWKH/Yjyub3ImZni4WUzPYRKd1krHCDWhAbe94c0X tbpkCTYzmM6hTnBR8TQUcf9YxqKAM2ih1bRvDDN5j71arfecOzkSO8Ui4IHFN+9obHkx YfvEhryAPVzg8I3Z4P9c61u6cT5g/CDLtUezaNjWxDc3xMiKtsogSd47inP5an7FHoco 8gmwCJI3oT9yY9n37MOS65n9cQ+o14h7h97uFDCif+US2tx9akEexJAjyn9isGJKSaSB Z3fRo3zbSXNdpAxl7ytaKzF6TnNa+EaXWTxfOpPsZJERnvhxB944aoHtT4tO/1G011aU fBWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=T00V2Xsb; 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 e4si3328676pgh.434.2019.07.25.08.07.42; Thu, 25 Jul 2019 08:07:43 -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=T00V2Xsb; 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 S2389001AbfGYPHl (ORCPT + 29 others); Thu, 25 Jul 2019 11:07:41 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:29566 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388500AbfGYPHk (ORCPT ); Thu, 25 Jul 2019 11:07:40 -0400 Received: from grover.flets-west.jp (softbank126026094249.bbtec.net [126.26.94.249]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6PF652M009240; Fri, 26 Jul 2019 00:06:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6PF652M009240 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1564067166; bh=XVd6xCB986FgI4lziNdiIUd8DbxIxrs0iKDny4AAdqY=; h=From:To:Cc:Subject:Date:From; b=T00V2Xsb5bCcGQQk5pgc3prcyt3Phib8cIT3GY0L92nITXEUXPTyTji6VjzVDkfYz FPEFhJvH7K0DuDH2Hbnm8If4baIhQVrNiZ/EZ0aG4RjjVCyt+yPzIUJM4g031KWxK3 iolsRmwr+MHopRqQhX4QHOYE41HA09WAwfvjARZYz+aWW5S7Ycc1+/RHeOSU3xSdCM dZiKxyhY5uQIUt4g0W7RvGT2VoO7ytHJcD7oTzMC0qwVmeAccSHLUYDH2pjN1r2r8l k0yNdkD7/gEFRzkN7tpOzYbpdKP7MoL1JiMnxx2Mg3FwWF9zhIS2MMDxbqQsFb0Asm VWkRCQVOxODGg== X-Nifty-SrcIP: [126.26.94.249] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jan Kiszka , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [FWIW PATCH] kbuild: create modules.order in sub-directories visited by subdir-y, m Date: Fri, 26 Jul 2019 00:06:00 +0900 Message-Id: <20190725150600.27007-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 Jan Kiszka reported a module build regression; 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 can make it work by writing like this: [Makefile] obj-m := some-module/ [some-module/Makefile] obj-m := some-module.o None of upstream Makefiles is written like the former. In fact, the former is a bug in upstream since modules.order is not correctly generated. For external modules, it was at least known to work, and being used by some people. This commit gets it back working, but I do not to want to encourage it for the upstream code, so I surrounded it by ifeq ($(KBUILD_EXTMOD),). Reported-by: Jan Kiszka Signed-off-by: Masahiro Yamada --- I just wrote a fix-up patch, but I am still wondering if it is correct to build modules under subdir-y. scripts/Makefile.lib | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 5241d0751eb0..9568888c97ca 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -25,6 +25,11 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # and -m subdirs. Just put -y's first. modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) +ifeq ($(KBUILD_EXTMOD),) +# External modules may generate modules under subdir-y or subdir-m. +modorder += $(addsuffix /modules.order, $(subdir-y) $(subdir-m)) +endif + # Handle objects in subdirs # --------------------------------------------------------------------------- # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a