From patchwork Tue Jul 9 04:24:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168704 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019353ilk; Mon, 8 Jul 2019 21:26:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKM9VgvEshp++H3jVsArqLXRSbmhn0Mb2OZhi8bF6zYRqk0NRPo59mz79Bj8ITN1/FuSjv X-Received: by 2002:a65:408d:: with SMTP id t13mr27984545pgp.373.1562646372278; Mon, 08 Jul 2019 21:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646372; cv=none; d=google.com; s=arc-20160816; b=a4ceHL5YqS7+XrBaS05KMDXo7RSMNdwKLwEndz9lER/a2mUqunpCxWuIydPWhVQ1ud QgVQbLW/eaM/iCyWzFyAifLINZpLY0rH4c6Vgl9VPzJhk8VecilAPzbdjJgj29PBal6e 8ielL0hABHx6ZK8QqNJPtTiwhdmiETTB7xxvmBxJHoY/L3rrXOu4+0Qhc+1nZA8JlE/0 n0+W6CblPYWyqEmvTKyoa2Lu0baTpAtkFUm0toQDrOLnRzJ6k2prZ2cQeEZmfDVSoW4q Nf287uR9xW/i6pKbfLbTYMCqWWF27J960n6C43uo6kNxzBCNz+M8dTN5Aqod1ClvHBVA yFLg== 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=iBlTAZJuJJ6+50j0WGjD4LyvREzE6vt9HBWQ8mbamWM=; b=tq8VAAJardVWCyng2MmT/XhgZ6ZVtdl/ln7pCYNtr6lhF93ZbFYTMyC/bR+eT0oXRb oQeJ3SsYuS6VAMZYUajiLPIsMoC2Q2oe+5bcIltYO8Fcb0TbDb74RlEWbkUUE9s0H4l/ LRmkj72eu8mQUY+sGJZtPSk5fV0vURDGG0eaaQsWyMrQRQP91kvb0XYOKe2wirozJUaY 3vgLoM1BQ9n0CiSuiQDgcpRXaZJ//mQSjoW6WrPXfCmqfiX7f83VUHt7HxhXaYsd4RXk MAWmz0kP834Q3aXzbPG+/ppvYz66FxdlTxg+aCTaWczAZU9SKfhVP4NPdgAarPa7ng07 hpZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HekhdKDx; 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 s24si21223555pgm.327.2019.07.08.21.26.11; Mon, 08 Jul 2019 21:26:12 -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=HekhdKDx; 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 S1727565AbfGIE0J (ORCPT + 30 others); Tue, 9 Jul 2019 00:26:09 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42175 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727127AbfGIEZm (ORCPT ); Tue, 9 Jul 2019 00:25:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVk009969; Tue, 9 Jul 2019 13:24:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVk009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646294; bh=iBlTAZJuJJ6+50j0WGjD4LyvREzE6vt9HBWQ8mbamWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HekhdKDxoDJEqpBGRw/bM/WReVW8JEMj5vTDoxmIOmauxgkb9SRw3YCaUUh528FGx PmzO8bd2BmeBP/DqTG45W/lG6AyLq2y7601d2ogLbhZuR29UQ8w3CFB4RlwFudfDYa okg6ukaV7SeSvkuGLlxM5Rh2yGSzUR9xlsM76E6qUK0ixai2aSWpDSdoS5be9TUi3W BdbQxVkm0w9x5ttJyvgipizBQBNpqvQMsU5pDPs0yfKU5y/VMML9l9BkAqxFphKKWK zJ2nVCvhi24btSI8bfRMTQIVEzYmWqoHorMqegak9tb/exc9Xje2uEaDHLUS5uADJ7 OnjQMbpWcUPZw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 01/11] kbuild: do not create empty modules.order in the prepare stage Date: Tue, 9 Jul 2019 13:24:05 +0900 Message-Id: <20190709042416.27554-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, $(objtree)/modules.order is touched in two places. In the 'prepare0' rule, scripts/Makefile.build creates an empty modules.order while processing 'obj=.' In the 'modules' rule, the top-level Makefile overwrites it with the correct list of modules. It might be a good side-effect that modules.order is made empty every time (probably this is not intended functionality), but I personally do not like this behavior. Kbuild descends into some directories in the preparation stage, where created modules.order files may be broken. Export 'preparing' while running the 'prepare' target, and when it is defined, do not touch modules.order at all. Signed-off-by: Masahiro Yamada --- Makefile | 1 + scripts/Makefile.build | 2 ++ 2 files changed, 3 insertions(+) -- 2.17.1 diff --git a/Makefile b/Makefile index 5c75ea7177f6..a31b672d512b 100644 --- a/Makefile +++ b/Makefile @@ -1000,6 +1000,7 @@ ifdef CONFIG_STACK_VALIDATION endif PHONY += prepare0 +prepare: export preparing=1 ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 776842b7e6a3..93c20664bcbb 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -64,8 +64,10 @@ builtin-target := $(obj)/built-in.a endif ifdef CONFIG_MODULES +ifndef preparing modorder-target := $(obj)/modules.order endif +endif # We keep a list of all modules in $(MODVERDIR) From patchwork Tue Jul 9 04:24:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168701 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019212ilk; Mon, 8 Jul 2019 21:26:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwShXGEz/nL6AQs52GJKTugMxD99IhPpDZ8UvQllmtHJ6aLgrcR/msKrxkKjyo26jFlivZX X-Received: by 2002:a17:90a:8985:: with SMTP id v5mr29851163pjn.136.1562646362204; Mon, 08 Jul 2019 21:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646362; cv=none; d=google.com; s=arc-20160816; b=IhhPcHm6udFj3LDsz89fh6QdXKCjZuyZAwZixJGlsMFdAw5kLGGjW84FipTsd4QtiN LIwdDvbgxnEAuDEwwS2vKxV9v27rXbyN/XH7rHA+LVzzDfFgBAS0LiBg82bSeUsUZ8E/ TqFYDEdICkXMgX+Wp9/dx6yFBVp8Ud1YuWfsbIMjJJxFozPU9Bz2xru97vFa5xI5XcRn pk6VS4tA6o96aNpt7Xo3N9xCBgfhQOMH0SeJ/pdDRXcVVKA8LfMEgyo0pscPjIYxtZW9 TsG5m6sEz6O0MQKDLuZKPeJu97UPj9nFCK4QSGnXB3Ud1Vg+WwGz9AJoSVoBqBfxnFOX M6tQ== 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=aPMz7hZjIVb3L/uoLF/n6Iw6fP28g9YGkw0KtaBRHOE=; b=RzHFu1ttLShvOcu3hosR1+0SBYZ3AAFW3rAm2VjSMWtH05NOyldN29gjk/QwHJYu/Q eXd+PeEPfM+833HRS7/tvYKwi56AmtjsydVdo2psbwYvcpqE6tnOZD4NdAOa31ZzBMdh nfZsYenZVAk6UoIVe2SjAv6dKmtL+Qnlk7Jem8bpN/U7JoD59KpeWriT0Qt5HWGKtnkg rxhAHXUhvN7Ou+v0EkLs7DHqGKVS6lxq892puh/ukFMeHwPRTJwnTaCK3nski3ukHHHx WE3f9XKiZSCkIz9+97sJg1+/3TfHvu+J0O2ShC4hW9QxoHRHvAunqqo77cGaBmF/B/Md g4rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="DkzaQ/me"; 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 y12si21635296pge.187.2019.07.08.21.26.01; Mon, 08 Jul 2019 21:26:02 -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="DkzaQ/me"; 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 S1727521AbfGIEZ7 (ORCPT + 30 others); Tue, 9 Jul 2019 00:25:59 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42159 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbfGIEZm (ORCPT ); Tue, 9 Jul 2019 00:25:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVl009969; Tue, 9 Jul 2019 13:24:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVl009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646295; bh=aPMz7hZjIVb3L/uoLF/n6Iw6fP28g9YGkw0KtaBRHOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DkzaQ/meidN8ccY5OmY6W/czewqVGkGcz9LARdHn3fRV+p2dJfcZeG4dn++xxS+YO iM0H63kxsICV397EyaznkXp1FXlwwItRJNxh5M/KGr3EW1ZBPSSuFeahOok/PgbfQV fnumI2yAbd6DBY96WwmpSbej9Y9iBt4oo6ydJmnpjFvWC4skh/hhCKygn9XynJKgtu u5pyqJcxr0GaT/L2d79A1geCURwDnoMkuv3T6quH5QlHYRjYiyKUNO9fbRhmBmxQFs oBjHpQkWu3x+LLYZEgHEAIndF/lzRy7xBJypVslHK2lV0uQ3t9atnhS9sJYQRPS1Ev Oqh+UpoxRkIPg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 02/11] kbuild: get rid of kernel/ prefix from in-tree modules.{order, builtin} Date: Tue, 9 Jul 2019 13:24:06 +0900 Message-Id: <20190709042416.27554-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Removing the 'kernel/' prefix will make our life easier because we can simply do 'cat modules.order' to get all built modules with full paths. Currently, we parse the first line of '*.mod' files in $(MODVERDIR). Since we have duplicated functionality here, I plan to remove MODVERDIR entirely. In fact, modules.order is generated also for external modules in a broken format. It adds the 'kernel/' prefix to the absolute path of the module, like this: kernel//path/to/your/external/module/foo.ko This is fine for now since modules.order is not used for external modules. However, I want to sanitize the format everywhere towards the goal of removing MODVERDIR. We cannot change the format of installed module.{order,builtin}. So, 'make modules_install' will add the 'kernel/' prefix while copying them to $(MODLIB)/. Signed-off-by: Masahiro Yamada --- Makefile | 4 ++-- scripts/Makefile.build | 2 +- scripts/Makefile.modbuiltin | 2 +- scripts/modules-check.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/Makefile b/Makefile index a31b672d512b..2f40cf704119 100644 --- a/Makefile +++ b/Makefile @@ -1334,8 +1334,8 @@ _modinst_: rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi - @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ + @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order + @sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 93c20664bcbb..d827b7a36892 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -428,7 +428,7 @@ endif # builtin-target modorder-cmds = \ $(foreach m, $(modorder), \ $(if $(filter %/modules.order, $m), \ - cat $m;, echo kernel/$m;)) + cat $m;, echo $m;)) $(modorder-target): $(subdir-ym) FORCE $(Q)(cat /dev/null; $(modorder-cmds)) > $@ diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index ea90a90b41a0..12ac300fe51b 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin @@ -40,7 +40,7 @@ __modbuiltin: $(modbuiltin-target) $(subdir-ym) @: $(modbuiltin-target): $(subdir-ym) FORCE - $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \ + $(Q)(for m in $(modbuiltin-mods); do echo $$m; done; \ cat /dev/null $(modbuiltin-subdirs)) > $@ PHONY += FORCE diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh index 39e8cb36ba19..f51f446707b8 100755 --- a/scripts/modules-check.sh +++ b/scripts/modules-check.sh @@ -9,7 +9,7 @@ check_same_name_modules() for m in $(sed 's:.*/::' modules.order | sort | uniq -d) do echo "warning: same module names found:" >&2 - sed -n "/\/$m/s:^kernel/: :p" modules.order >&2 + sed -n "/\/$m/s:^: :p" modules.order >&2 done } From patchwork Tue Jul 9 04:24:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168703 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019285ilk; Mon, 8 Jul 2019 21:26:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGa9Is/knSymRXLn7KugFiGXyxf8Zgsdbg9Ts6T1gScIvHbk/HH5LvzgY1klLcsLf4qE4G X-Received: by 2002:a17:902:d81:: with SMTP id 1mr30431807plv.323.1562646367205; Mon, 08 Jul 2019 21:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646367; cv=none; d=google.com; s=arc-20160816; b=rg0s050LzbsU6Fu0aAQtbuVvhXDtrac72d22PWzVHIFpzRFCukM8rWbkInniFXmww4 zVX+GGkwSqiHu5F/dn9gZ05GIUtgoSXEPY8KaM6uWoRFU3+uLLr0CIpArnKV/l3LAd2t 8QaP/6wAnGfw/Ufz+3JM0YRu5/yxcjpverCVKsLtc2SKXksV1dy+WSkPIHzz/0EBUBk5 9i27+XON8vOSpMLQmynnGEQTRuSOsIa0/VoiHdhUZeSbqHgiWgrb87BAHn1R3QeUWowV At9eY83SGEh5rSCcJbbmi2RIUVlCtiah5ZqjZs1MBHIa91GveKywkENFUb1rsrquc3ey QGng== 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=66C6WSUar+9fCnRwYJ6reDlsM+3fNuxKvxVBSvN7M4A=; b=fv5pG7j/7f+bsB6nVvJ9NTW1iuK0EzkYdkmnXZwZEOalvXZ68U6cTu0sD6TsETTb35 RERA7geer7wAy/NnjR8pYHvg+q+MlZl/QZvPXQcLZDZx7z3WNbd0ou+X3C7a8J1+o+Fk cBUmbkgDyMFuqFf3DQP3zIT6Eevdrs7Xo3iF25sfwuu/qdkMS14MgcUtsnOiWLN6LWkI noPhOBklp1BKSYnKol7Rn7W8W8hP+L6576D2Wg/OLYjL2ojO/k1whndG9+33+CGLpXU1 v0qbHVcFg4rI/1tcIzfOW6UMyISa7Q6upLn6RHq7NC7G+UJTXqZMq9Z4SceR9nVI7lRV njCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=q46wm6dj; 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 3si20241652plx.344.2019.07.08.21.26.06; Mon, 08 Jul 2019 21:26:07 -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=q46wm6dj; 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 S1727545AbfGIE0E (ORCPT + 30 others); Tue, 9 Jul 2019 00:26:04 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42171 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727132AbfGIEZm (ORCPT ); Tue, 9 Jul 2019 00:25:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVm009969; Tue, 9 Jul 2019 13:24:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVm009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646295; bh=66C6WSUar+9fCnRwYJ6reDlsM+3fNuxKvxVBSvN7M4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q46wm6djBsOMl+UO7ZtYGgKPKq/5uWI1+EejrxIb6jgSgMFQ75kuiq914nMu/wkox UWaJOaXFTlI5UhkkLDUw5QQuPkYP8GjokqLebrW67zJHWz0kyhMvyRX49SqaXWWfn1 5RaasWQ5LjZz8w/Y4fT/31ZmXAHnseqIBx/ca06Ykr/fzMTffYKvlgqd7UFZ+serXT jjgFvGFxeVK7+c7kDsUZLRxNkEt7puygIvDtSYROgA20ui1qdp+fue7Zao5DT2g1n0 Qq7eJnIjoFVv3Bow8jCqqUiIm6AU9unVIBnewsUY87vlr6oNdqb1cMNSHYTnvjJraF xBdJgoF5+M7FA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 03/11] kbuild: remove duplication from modules.order in sub-directories Date: Tue, 9 Jul 2019 13:24:07 +0900 Message-Id: <20190709042416.27554-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, only the top-level modules.order drops duplicated entries. The modules.order files in sub-directories potentially contain duplication. To list out the paths of all modules, I want to use modules.order instead of parsing *.mod files in $(MODVERDIR). To achieve this, I want to rip off duplication from modules.order of external modules too. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d827b7a36892..1492e37c3927 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -425,13 +425,10 @@ endif # builtin-target # # Create commands to either record .ko file or cat modules.order from # a subdirectory -modorder-cmds = \ - $(foreach m, $(modorder), \ - $(if $(filter %/modules.order, $m), \ - cat $m;, echo $m;)) - $(modorder-target): $(subdir-ym) FORCE - $(Q)(cat /dev/null; $(modorder-cmds)) > $@ + $(Q){ $(foreach m, $(modorder), \ + $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ + | $(AWK) '!x[$$0]++' - > $@ # # Rule to compile a set of .o files into one .a file (with symbol table) From patchwork Tue Jul 9 04:24:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168696 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019027ilk; Mon, 8 Jul 2019 21:25:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqylU5pVU95sgeIu9MmoLvNZaA0EL0qo2zSBzWC7mJKyOZnAKl/qMVI7wJzz1piq8ukkZ4Hv X-Received: by 2002:a63:3c5:: with SMTP id 188mr27634178pgd.394.1562646346322; Mon, 08 Jul 2019 21:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646346; cv=none; d=google.com; s=arc-20160816; b=WVIPoC4YWOV/10BcyyGDcw2w8aaiWxOeXWt1wWbeQapGqdJV30nBK9Y4XK8QZu+U1a vZSeGXTHpy05stC4PDcAuALB+lPb5sxKo0ERDAmmWGkQyxOgkGKv4rn2rhOSb6GIUzv7 Ie4ojXRPlPehmUkzwIEY3Z0ZG7xp3vzrK8CYrsKFKhlpUNMsXchIbWV4VNdnXt57myF2 lIk53mqWz5yPwXMCbDbJUf6jO9Tpa4RC3qQTlIB7wpJPApLSFni6k1+aF8dxefkC/yCl vhBeJv+LNPx3kpS8kH3vzhgD9GknqeI02190/bd4btHtmhEyQVKE61GJZ2rXixq/c3OS 8ekA== 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=5nWs7/nqfQz6GjAJbPPMqdQM8R/kzVjvDPkmY/vF878=; b=vpkJeSfvp0ZyCu+L1XnYDjbWRC9A7SanWyTB8IHsxwkvbWCJeammyaqOA8llJRmxQ7 19glbY6Fv0/iMiYsxLnnwSeftwpK91oj4yNQ1N/fc65l2bk/RVpxgk04kX7cFR6QXOAf k74U0Gqlx2vd7Nx7ggT9LAKlj7JAs8aghn1Zf45dWG/59Z3PCjzTPWLGxWeRd1M0ujVC n4EzUQb3dHOHzLAaXajw1VG7e88CZoW/dps6e11iTFS5NOmi0S6eyuJBN9r8/HOoqQFN 7SjWLKZwckgJv1erAdUDoqSUzXUxWRItt0Uyrb18JZu74vxD03/S47NRDqK/N3dTR5S+ rjPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=KXhQ5tft; 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 b93si20826176plb.11.2019.07.08.21.25.46; Mon, 08 Jul 2019 21:25:46 -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=KXhQ5tft; 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 S1727424AbfGIEZo (ORCPT + 30 others); Tue, 9 Jul 2019 00:25:44 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42160 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbfGIEZl (ORCPT ); Tue, 9 Jul 2019 00:25:41 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVn009969; Tue, 9 Jul 2019 13:24:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVn009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646296; bh=5nWs7/nqfQz6GjAJbPPMqdQM8R/kzVjvDPkmY/vF878=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXhQ5tftVYFpZ3lwtqgdh7MBeEKfaX9BSHQKGyw1DEnmO8OXtJTFbPqvG8/8hw5o5 07xfbmZn5Ru+y04MCFDJB8tlsHrbhZN0iCPXmrjmGURx00kvqohJ7/7eIrP8kNmg9W 8RxmYnir1mJi5/opP23NRm7sIfg83gXdQ0M4dJQ9MosSMKCdaH39mKfqPydkVCIQlN 1SNhq5KfdG9ZJHiPLwYU87xZv+xycc6mOD0OAc7TJKsuJGFqz6UaZsbsORU0UJh3gw BZeDj+19fnAPk+GANqVdnaIaNPVzojMMwr3Vft1pS8UP76cnUw2+AK5qkvk5srVJ6x qzMkAOfa2WTSQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/11] scsi: remove pointless $(MODVERDIR)/$(obj)/53c700.ver Date: Tue, 9 Jul 2019 13:24:08 +0900 Message-Id: <20190709042416.27554-5-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nothing depends on this, so it is dead code. Signed-off-by: Masahiro Yamada --- I will apply this to kbuild tree since it is trivial. drivers/scsi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 8826111fdf4a..acdd57e647f8 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -183,7 +183,7 @@ zalon7xx-objs := zalon.o ncr53c8xx.o # Files generated that shall be removed upon make clean clean-files := 53c700_d.h 53c700_u.h scsi_devinfo_tbl.c -$(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h +$(obj)/53c700.o: $(obj)/53c700_d.h $(obj)/scsi_sysfs.o: $(obj)/scsi_devinfo_tbl.c From patchwork Tue Jul 9 04:24:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168697 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019036ilk; Mon, 8 Jul 2019 21:25:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx4VqQ7X9lFP15oh5QF15ZY/31CD/vME5U0iJr85GpnVlwGWmzxNAFLrOrNdXKgacdVR4/ X-Received: by 2002:a63:231c:: with SMTP id j28mr27627256pgj.430.1562646346769; Mon, 08 Jul 2019 21:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646346; cv=none; d=google.com; s=arc-20160816; b=SayjPrQAQ0pSUYAVC0uP6zcfWxtJM5NEL1k6TyKorn0uZ3Smpvyu7VLQrIDI5Zhwgr Y4zp+YDknwe83vjdAwGEGGKonIrTIavSLNdarj7q0gZIb2CzbYRyTA9TrmmQqbGXx7Zc uNvIC5PDfoNUXN3hAqW/yM1goJAXarpOGEDsHTmZu/WYGLAVdXmezTgK+OyX5V9Zy+fx TpLvAm0W/e+im9rA8AT1GFnlZd3jJ72dc2kuMvxYELa/CdvtYtu2Y9TGOFVYeste7U35 DfhrHKgFeHlWChuWbf3EigGg22mzsQw4pZmGQ6z9zmyWsDrhJOQoaRSAHiiPuOlS4fpY mNAw== 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=X1+deifnjdjSHLxV0pVUrGpafNj40fiq1sx4t0gZorM=; b=QLcEDy+JXDNMwMHoSdbeHQMSZ0gLFfd6CsyHtUbW8dqgsmbeMT1kBFIbYygpZiWaKW 31Ez9/MrDm82K6i54dULBFW4LGqwhTP7sL/gRFI25DIenFjPphdakIq9NFzJX2sxbw3g Xq7rq/m1//2/Do7O83KyW25rmSofeBgUbDCdZJlj4lQ7Q2s51eBtctb/yinaf6MYW50b Ly38xEk0u5XwS5r/LQwsrRiQncOLKdaWMlgPnz4V7f2PiqZwkhTEQ+nSsotVqhbjnstx Hq05uBXSNXwKYylPQbLxcO+NOHnP6zgFefMKQ4nq8bO4n0l5+2bXiZY84qwKb0aZlrx3 XJwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Zg+UQJmy; 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 b93si20826176plb.11.2019.07.08.21.25.46; Mon, 08 Jul 2019 21:25:46 -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=Zg+UQJmy; 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 S1727450AbfGIEZp (ORCPT + 30 others); Tue, 9 Jul 2019 00:25:45 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42168 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727088AbfGIEZl (ORCPT ); Tue, 9 Jul 2019 00:25:41 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVo009969; Tue, 9 Jul 2019 13:24:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVo009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646297; bh=X1+deifnjdjSHLxV0pVUrGpafNj40fiq1sx4t0gZorM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zg+UQJmy7E8cn5faf6+Vg27zaelbAEWXhvAezc1dOOJg63MBjWxu+xikR8JGFx0YU /laI/bxxIArWJEWpda2PHKitHbRVa1pysJXLABDnUveVHYQIkjWJbwYp9sGk0zmbY1 xNXlECMA5d/UPPW2Adc84OJC4s+YN0olEEoUkPmLM/fXOly+gnWxF5I+7EHmi5BZ+w Dw8/l8sNJoFb7w8MqV+IpgKlDt/oh5r5cctsV34uxdWTpkWZR5AJ8WZyLakMoOmu3C Jafsq6nbuGgntDX/2PJi7tlZlyvox2+Rk3BkQKO4lr4WckdL4NPGDuaagM0w4GSnuu hY+/glG8bH5ww== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 05/11] kbuild: modinst: read modules.order instead of $(MODVERDIR)/*.mod Date: Tue, 9 Jul 2019 13:24:09 +0900 Message-Id: <20190709042416.27554-6-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be installed. This is simpler than parsing *.mod files in $(MODVERDIR). For external modules, $(KBUILD_EXTMOD)/modules.order should be read. Signed-off-by: Masahiro Yamada --- scripts/Makefile.modinst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 0dae402661f3..5a4579e76485 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -8,10 +8,7 @@ __modinst: include scripts/Kbuild.include -# - -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) -modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) +modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) PHONY += $(modules) __modinst: $(modules) From patchwork Tue Jul 9 04:24:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168698 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019096ilk; Mon, 8 Jul 2019 21:25:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQvlpzqiVepxF+9rqoIrdRCva7hErOJ5LlJCcPu5nemXgXFb0Nf3pk9f2GM0ZJdQzN4kOC X-Received: by 2002:a63:490a:: with SMTP id w10mr27668382pga.6.1562646351697; Mon, 08 Jul 2019 21:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646351; cv=none; d=google.com; s=arc-20160816; b=R/ZveLFySDuaER52rGJczMRcjk9shyOKjU2YJJOOrlIt/eNDJEHX3GaPvNUq5mPdwc mk4cLgBtLZpMScUJLEDQko92B0DlnW5j/lPDVgTnyA+DmorV06PpsHzZhcnyHJyyu4dH LSn7NZ5sv8XeVLADNwr5ELIYfIR5hUNCmW7i/0J9Qzb5iYeWa25jL7zdNufTOwtija4l i5pNFRsY1qn5l5cOa/vfC3gv0niVxv9dUTe0i/edFgR9LyxRHg9g5Sra6ANZfpKaHg3C +B8j++tNbXl19v5cT9/m0xEYqPlfqgz/MHG7P79gtCJYFk9aPIpo3c2cQgRzQOlUJ6mf slGg== 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=9GTu+fhEWSsaBmqXT5Bo1ItxiSb25+D5qSp//fAlJHI=; b=GaxDttEedrHpruwoWortNUIIlS8EHffiEhZRiNlkDaFOuewN56FGfw9JyBjcSBFZKP ZxsqhnKSL9Y4VatWUYFK19zmKVpHiE04eShZmWl7cv8M3mrqi3O0F8X7ojIuuI19wIEd ADvaYV9s7RHD0rS1OfPbLb0TYuEp+Rmy8YfQH858fODGMgmCtXkMs9u5kMpZEBmozt6B aOrITHX28RULX5ECRwMLViQNt+4GG6sHlb4ZcRCUeYNEA5zF83nQJuNRo4lYiw0bh7ZO ZMmnOLEk3QvlSG1h5DgfyvQPEH5YZFuN4B49JQoFnfqI+KnBvkwwpdATx4HL6bZP3WPu KGyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=RynN3YqE; 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 z25si20039932pgk.415.2019.07.08.21.25.51; Mon, 08 Jul 2019 21:25:51 -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=RynN3YqE; 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 S1727386AbfGIEZn (ORCPT + 30 others); Tue, 9 Jul 2019 00:25:43 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42169 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727076AbfGIEZl (ORCPT ); Tue, 9 Jul 2019 00:25:41 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVp009969; Tue, 9 Jul 2019 13:24:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVp009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646298; bh=9GTu+fhEWSsaBmqXT5Bo1ItxiSb25+D5qSp//fAlJHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RynN3YqErvmL/4fPzpAU7OmzJQFrUjduikscS1EBsDjjl0ia0n94ootoO0O81BxaI 6u7ZKygViNX0ZYW4PIuFExrU7PXYTjT3YSibs04PMnHqeIqz7Xs9RkD230xlUAdWVv BNQIqTIF0OZhUKV7SO/E6r1cQ7XP8rVQcLGsn2kRdlpkw5fF4viTevwX7mchammvxb i8H9F1CMvQK3ST1YYxbi+eRzB7CgTusECLRwmg12d3OrVtr+D2aZ9GHdH2DlgX/APD C2f0KfeFx5IxwyeyJ1SLIO6GHzeovv2qOIj9IEmQcussE3uAY81P6bO4/qB7NURWAc s10bsPfeTVquw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 06/11] kbuild: modsign: read modules.order instead of $(MODVERDIR)/*.mod Date: Tue, 9 Jul 2019 13:24:10 +0900 Message-Id: <20190709042416.27554-7-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be signed. This is simpler than parsing *.mod files in $(MODVERDIR). The modules_sign target is only supported for in-kernel modules. So, this commit does not take care of external modules. Signed-off-by: Masahiro Yamada --- scripts/Makefile.modsign | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign index da56aa78d245..d7325cefe709 100644 --- a/scripts/Makefile.modsign +++ b/scripts/Makefile.modsign @@ -8,8 +8,7 @@ __modsign: include scripts/Kbuild.include -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) -modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) +modules := $(sort $(shell cat modules.order)) PHONY += $(modules) __modsign: $(modules) From patchwork Tue Jul 9 04:24:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168707 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019548ilk; Mon, 8 Jul 2019 21:26:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRUQIp88SGuTGOPtmWN11azsPaJaZkii8cqad0ZSaknoByYBm2mkAnzAbph6q1Ou9RYO9F X-Received: by 2002:a17:902:9a42:: with SMTP id x2mr29818675plv.106.1562646385289; Mon, 08 Jul 2019 21:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646385; cv=none; d=google.com; s=arc-20160816; b=qwp6x+7KoQpQYkxjg5/8rPDFAVv5gi6v6gCsFQlOd+hkrrHvKAG5YRM61beealoEhH sSEEdHmFxAH2n2bRHzSiviJ/JCSRZbzL6QwJDP4t5ZaoTF9hUTILXMMtDrVEeNfaEKo3 jZUFVeHqik3zBSCuF2kZfPhwlaF0ud/0YgXKcxYfuBVmY8sziJJHvLugfUMBeNaEGm52 wXW9zIMEgO9wW14mDoUQNQFGwqgKKADd02gufo9MTysGCgd9trbxLhug1YnOWME4I80u c+huu0u8eKOCBCDWcTYarDNOHmOBzEZ5wR4LBiO6M4nlfmhxH3kt4Ge+E18d6AuqX6io yZMQ== 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=65qATP3r4DXqcauZnw/DiveAPOtcG5uX+EGbDl+x5RQ=; b=s7nZ4UZPT9dcgJQwL43UltvutrgE0B0ypteW1f++NUjteLRVB35vd7dfudPBRj16H9 jWhX3zW55hEkdAT0QEMg/yd08eAZi84jIYxfU18Y2TArvMzq325eOgPYLVidMPs6pquH LkjL5MAj02MH6h9u9kAJnSvNQYAM2xLh9tsj0qoXe7MyvCnsbMORESVaaHSU+/qMq5Te 8uTj0yWHg0jZ4S8J5MlTkIL3r4DmY8diVboy0h+imjPjjJJySl16a0JcB3qzVURxpbn9 +kgBf3Leieo0geJJhPbplBs8d2UNukooe0P1NxFf9ZL3FUn6k5NfSerBaP/UiTgaImXB BoDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dxO7Tl84; 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 w14si1512284pjn.15.2019.07.08.21.26.25; Mon, 08 Jul 2019 21:26:25 -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=dxO7Tl84; 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 S1727619AbfGIE0W (ORCPT + 30 others); Tue, 9 Jul 2019 00:26:22 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42158 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfGIEZm (ORCPT ); Tue, 9 Jul 2019 00:25:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVq009969; Tue, 9 Jul 2019 13:24:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVq009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646299; bh=65qATP3r4DXqcauZnw/DiveAPOtcG5uX+EGbDl+x5RQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxO7Tl84MEUcbZZOPxR6MrDUMh+K9tBQYUbUVWDakXdcZMK8U2fxyVmNIS4rLjN05 Q3h6Orm4aVEf89XwvMBbCieP2prZQ99bc4gp/CU8sdyNa1Xl1ro3b2HHPXZJevi7DT SuvWn3dY0zZ7/6h059uSng0gbQdauW0Ci8FmUezKBIIphWRBLcn9YYoluolpyf2jJ3 uLTMXPSR++z0EXTCrwglQ+9KlG0+JGnI30bWsvlGz0ALNc5jHe102DDJmBIRSH0pu0 SqYk7CSeK/KkTf0ErPIf8bZ+P8hojYS6FyXqt0kYLTny0hXQfoMJNSSaEddsrxknLY cfT2mIVZZEppQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 07/11] kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod Date: Tue, 9 Jul 2019 13:24:11 +0900 Message-Id: <20190709042416.27554-8-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be processed. This is simpler than parsing *.mod files in $(MODVERDIR). For external modules, $(KBUILD_EXTMOD)/modules.order should be read. Signed-off-by: Masahiro Yamada --- scripts/Makefile.modpost | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index fec6ec2ffa47..2ab1694a7df3 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -8,9 +8,10 @@ # b) A .o file which is the .o files above linked together # c) A .mod file in $(MODVERDIR)/, listing the name of the # the preliminary .o file, plus all .o files +# d) modules.order, which lists all the modules # Stage 2 is handled by this file and does the following -# 1) Find all modules from the files listed in $(MODVERDIR)/ +# 1) Find all modules listed in modules.order # 2) modpost is then used to # 3) create one .mod.c file pr. module # 4) create one Module.symvers file with CRC for all exported symbols @@ -60,10 +61,10 @@ include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers -# Step 1), find all modules listed in $(MODVERDIR)/ -MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u -__modules := $(shell $(MODLISTCMD)) -modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) +modorder := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order + +# Step 1), find all modules listed in modules.order +modules := $(sort $(shell cat $(modorder))) # Stop after building .o files if NOFINAL is set. Makes compile tests quicker _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) @@ -84,7 +85,7 @@ MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS))) # We can go over command line length here, so be careful. quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules - cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) $(MODPOST_OPT) -s -T - + cmd_modpost = sed 's/ko$$/o/' $(modorder) | $(modpost) $(MODPOST_OPT) -s -T - PHONY += __modpost __modpost: $(modules:.ko=.o) FORCE From patchwork Tue Jul 9 04:24:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168699 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019129ilk; Mon, 8 Jul 2019 21:25:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLZ+cGmGLR1ttWcb7+FyAro0NqegPpgLJcl6CmICXDfv0huWJ9VpVKTRNa3HFu5ftWwOKE X-Received: by 2002:a17:90a:214e:: with SMTP id a72mr31004791pje.0.1562646354440; Mon, 08 Jul 2019 21:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646354; cv=none; d=google.com; s=arc-20160816; b=r3tkBKWLmVSrqV9iyRnPcnyKyY359j7vJAFRiLp6jYGVOlJhFrMds4OA6cLBRu4UDh 6tjFZK/rhmdP3z6KZLUhdbk5J4a0NawHC1jZqG7N0vBqzFSf/lqiDT6ZR37WeQ9DLQ+Q h3nNMQjFOn9XshFQbi6nhwKM/AVSwGvN2EuOmHUt9INXEWeJHP1ZnxXbWIv6dTPU4otE RMof5tpN7jO1yGOjHjBjGtOkTlSkDr8Ip6ZiboViMQtV/Pbug5DJH2MZiBEkfX7U5PrY TD9FkrYb1Zn0LVeasfXR3YbSjkfpHDZet/1wxbha/t6ZcO5D7bphYzOoyYb9mMRt6Zl5 RwZQ== 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=Q+SzS7vD0yVNOyjqQdvY9kfGxu0p784rrS+yRzVFgSA=; b=mNXPO5sq3yPHT5R+pHHMsrrSfR9z8Gy2jaJOBNVoxmKKyCid6hg4io0/W/K9Z9sEKT hnvgP/rVRoMuruWcDuIXAXSe6bg/1SdY8DfVMuC2QZJ6SCX+FIgroO5tHpPDy1mBW00i uPS+3A0uesMnxbx9reyGhMhbpI5SvYQ6qxXPv2s093eOOwtP5n/QUABNgGhSHmTpDnyu HFYb59GHla9KEEXQtVXMztEDFWa2iZg94ybj6WrGxiCFuHkhdS/8yzbCBUkbr6b+1c8q 0zDCIBvrKpZX01WwaBw/k4j4wlTZceue4byjAlo167tfQxJb/HfMmZE4YyRFNmfVYKhL C0fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=sGs1wdFv; 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 g13si3652521pgp.405.2019.07.08.21.25.54; Mon, 08 Jul 2019 21:25:54 -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=sGs1wdFv; 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 S1727480AbfGIEZw (ORCPT + 30 others); Tue, 9 Jul 2019 00:25:52 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42417 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727088AbfGIEZv (ORCPT ); Tue, 9 Jul 2019 00:25:51 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVr009969; Tue, 9 Jul 2019 13:24:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVr009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646299; bh=Q+SzS7vD0yVNOyjqQdvY9kfGxu0p784rrS+yRzVFgSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGs1wdFvX0O/6eZhSwsTmCb4K6NHClzNU+2d7uHIna+kIXdblJ4xRGAow6rUgMLfX WGKNhEwNQB5h/8dPRpPRQA1JzWOBDy3WkmW3R63bnNwr+dunWzgRazn1dsxAfMji4m VKaP8ZZ4HCRH6b/NulRoXFpiS7p1hhe6hdZnbGM2Sq3xr76fRBw5nIG87MY8oF3nSH I+pXPG3h9gffthUZvv41g6Vca7Row1w+zj01e4zWtY5QMi9NqrDno1txSyVhYTpE+R pIglRqygif31WXxTUF+jig2MEI40sCX381PhnsSLAe2upAnuLX9t2bUp/D5tcdNsxI g76ivP50f5oJQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , linux-doc@vger.kernel.org, Jonathan Corbet , linux-kernel@vger.kernel.org, Michal Marek Subject: [PATCH 08/11] kbuild: create *.mod with full directory path and remove MODVERDIR Date: Tue, 9 Jul 2019 13:24:12 +0900 Message-Id: <20190709042416.27554-9-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While descending directories, Kbuild produces objects for modules, but final *.ko files are linked in the modpost. To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR) for every module it is building. Some post-processing steps read the necessary information from *.mod files. This avoids descending into directories again. This mechanism was introduced in 2003 or so. Later, commit 551559e13af1 ("kbuild: implement modules.order") added modules.order. So, we can simply read it out to know all the modules with directory paths. This is easier than parsing the first line of *.mod files. $(MODVERDIR) has a flat structure. This is based on the assumption that the module name is unique. This assumption is really fragile. Stephen Rothwell reported a race condition caused by a module name conflict: https://lkml.org/lkml/2019/5/13/991 In parallel building, two different threads could write to the same $(MODVERDIR)/*.mod simultaneously. Non-unique module names are the source of all kind of troubles, hence commit 3a48a91901c5 ("kbuild: check uniqueness of module names") introduced a new checker script. However, it is still fragile in the build system point of view because this race happens before scripts/modules-check.sh is invoked. If it happens again, the modpost will emit unclear error messages. To fix this issue completely, create *.mod in the same directory as *.ko so that two threads never attempt to write to the same .mod file. $(MODVERDIR) is no longer needed. Since modules with directory paths are listed in modules.order, Kbuild is still able to find *.mod files without additional descending. Signed-off-by: Masahiro Yamada --- .gitignore | 1 + Documentation/dontdiff | 1 + Makefile | 20 +++----------------- scripts/Makefile.build | 8 ++------ scripts/Makefile.modpost | 4 ++-- scripts/adjust_autoksyms.sh | 11 ++++------- scripts/mod/sumversion.c | 16 +++------------- scripts/package/mkspec | 2 +- 8 files changed, 17 insertions(+), 46 deletions(-) -- 2.17.1 Acked-by: Nicolas Pitre diff --git a/.gitignore b/.gitignore index 7587ef56b92d..8f5422cba6e2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ *.lz4 *.lzma *.lzo +*.mod *.mod.c *.o *.o.* diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 5eba889ea84d..9f4392876099 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff @@ -30,6 +30,7 @@ *.lzo *.mo *.moc +*.mod *.mod.c *.o *.o.* diff --git a/Makefile b/Makefile index 2f40cf704119..958fafa605b9 100644 --- a/Makefile +++ b/Makefile @@ -488,11 +488,6 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL export KBUILD_ARFLAGS -# When compiling out-of-tree modules, put MODVERDIR in the module -# tree rather than in the kernel tree. The kernel tree might -# even be read-only. -export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions - # Files to ignore in find ... statements export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ @@ -1034,7 +1029,7 @@ vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) # Recurse until adjust_autoksyms.sh is satisfied PHONY += autoksyms_recursive -autoksyms_recursive: $(vmlinux-deps) +autoksyms_recursive: $(vmlinux-deps) modules.order ifdef CONFIG_TRIM_UNUSED_KSYMS $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ "$(MAKE) -f $(srctree)/Makefile vmlinux" @@ -1118,7 +1113,6 @@ endif prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \ include/generated/utsrelease.h - $(cmd_crmodverdir) archprepare: archheaders archscripts prepare1 scripts @@ -1376,7 +1370,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) include/ksym +CLEAN_DIRS += include/ksym CLEAN_FILES += modules.builtin.modinfo # Directories & files removed with 'make mrproper' @@ -1637,7 +1631,6 @@ PHONY += $(clean-dirs) clean $(clean-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) -clean: rm-dirs := $(MODVERDIR) clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers PHONY += help @@ -1651,8 +1644,6 @@ help: @echo '' PHONY += prepare -prepare: - $(cmd_crmodverdir) endif # KBUILD_EXTMOD clean: $(clean-dirs) @@ -1663,7 +1654,7 @@ clean: $(clean-dirs) -o -name '*.ko.*' \ -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ -o -name '*.dwo' -o -name '*.lst' \ - -o -name '*.su' \ + -o -name '*.su' -o -name '*.mod' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.lex.c' -o -name '*.tab.[ch]' \ -o -name '*.asn1.[ch]' \ @@ -1792,11 +1783,6 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ $(KERNELRELEASE) -# Create temporary dir for module support files -# clean it up only when building all modules -cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ - $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) - # read saved command lines for existing targets existing-targets := $(wildcard $(sort $(targets))) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 1492e37c3927..1d01324455d1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -69,8 +69,6 @@ modorder-target := $(obj)/modules.order endif endif -# We keep a list of all modules in $(MODVERDIR) - __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ $(subdir-ym) $(always) @@ -280,13 +278,11 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) -# Single-part modules are special since we need to mark them in $(MODVERDIR) - $(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) @{ echo $(@:.o=.ko); echo $@; \ - $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) + $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ @@ -468,7 +464,7 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \ - $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) + $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-m) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 2ab1694a7df3..3e229d4f4d72 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -6,8 +6,8 @@ # Stage one of module building created the following: # a) The individual .o files used for the module # b) A .o file which is the .o files above linked together -# c) A .mod file in $(MODVERDIR)/, listing the name of the -# the preliminary .o file, plus all .o files +# c) A .mod file, listing the name of the preliminary .o file, +# plus all .o files # d) modules.order, which lists all the modules # Stage 2 is handled by this file and does the following diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index aab4e299d7a2..d3561ff4089c 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -47,13 +47,10 @@ cat > "$new_ksyms_file" << EOT */ EOT -[ "$(ls -A "$MODVERDIR")" ] && -for mod in "$MODVERDIR"/*.mod; do - sed -n -e '3{s/ /\n/g;/^$/!p;}' "$mod" -done | sort -u | -while read sym; do - echo "#define __KSYM_${sym} 1" -done >> "$new_ksyms_file" +sed 's/ko$/mod/' modules.order | +xargs -r -n1 sed -n -e '3{s/ /\n/g;/^$/!p;}' | +sort -u | +sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" # Special case for modversions (see modpost.c) if [ -n "$CONFIG_MODVERSIONS" ]; then diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 0f6dcb4011a8..166f3fa247a9 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -396,21 +396,11 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) unsigned long len; struct md4_ctx md; char *sources, *end, *fname; - const char *basename; char filelist[PATH_MAX + 1]; - char *modverdir = getenv("MODVERDIR"); - if (!modverdir) - modverdir = "."; - - /* Source files for module are in .tmp_versions/modname.mod, - after the first line. */ - if (strrchr(modname, '/')) - basename = strrchr(modname, '/') + 1; - else - basename = modname; - snprintf(filelist, sizeof(filelist), "%s/%.*s.mod", modverdir, - (int) strlen(basename) - 2, basename); + /* objects for a module are listed in the second line of *.mod file. */ + snprintf(filelist, sizeof(filelist), "%.*smod", + (int)strlen(modname) - 1, modname); file = grab_file(filelist, &len); if (!file) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 2d29df4a0a53..8640c278f1aa 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -29,7 +29,7 @@ fi PROVIDES="$PROVIDES kernel-$KERNELRELEASE" __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") -EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ +EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s" From patchwork Tue Jul 9 04:24:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168706 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019453ilk; Mon, 8 Jul 2019 21:26:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5SOWO8IWvjJwI89axr2YXwRlph91ognky6yhufl8utlo6XjYUfz5WYG6HeXCGD/AlJanf X-Received: by 2002:a17:902:925:: with SMTP id 34mr29037106plm.334.1562646378462; Mon, 08 Jul 2019 21:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646378; cv=none; d=google.com; s=arc-20160816; b=OVm4Hocg4CzhoM18P8iEZBm0rARd7BPJBXDfvK/wVgB1a76HrJTYr9dXZRQynpiC+5 bfB8ywXZ/dE2pWI7gbFbfbVt1IBsbfKljgTKDpxSyfrslnYZvBqj4r+dFdcaGV6BBdyw AtCQGmOU4UlWdrWfljg5R0td5eDWacyQozQTpHVpcuraYJJ1MbyFwtPGT5UrGyb5UUwh PknXgu+lcURAMM/lCnrztvDxFih2HE9BFmkUYeZCrM7C4sdPBnuOQWTY1y00YDxlvpEy 68IXw5JGUhFe0j+QAl+N8VNUq/8dg/idPtM2vpBAiP6VxsmfxVXNkMI8ZLXtnK2S6D9s Xv9w== 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=m+NQODuw2GuTBAmV1RxTAD4JOmrs8n7px1scpZ29taI=; b=RMy/3olig8h8xdyZBmv3ZyBMO5FA5xPyCySP8SsyaQO7p3s1Phkt5IOVand1oi536+ 7X74N+66VkctBYGmNL1JxVwxM6C9O9FjLdH+4Zk+bdOH3nxCfjK9XOUps1lIV8f3AtSF ZUL1BFoyy24zNjnvSjwlRuRTRtR0EYKoXIQbHaePa5779LRjPi4s3byZJbDNMxHlMbz6 5/M8sz/Guf5dBjoBckv4iDLhD5WslVfnIkaBm0A7ccD+r3qjqGRVzasqfUeiQz2EJXrC 8c/5ZfmTZlImtpeKyBmhcdAT1ydIATFzr232OYA8VAvUcGPlZpRi+G7Y7l+ipuaPreZp I39w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dh+GnIu1; 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 h8si1494041pjs.13.2019.07.08.21.26.18; Mon, 08 Jul 2019 21:26:18 -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=dh+GnIu1; 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 S1727605AbfGIE0P (ORCPT + 30 others); Tue, 9 Jul 2019 00:26:15 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42176 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbfGIEZm (ORCPT ); Tue, 9 Jul 2019 00:25:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVs009969; Tue, 9 Jul 2019 13:25:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVs009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646300; bh=m+NQODuw2GuTBAmV1RxTAD4JOmrs8n7px1scpZ29taI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dh+GnIu1b/TBiCwMYEhgrklCBP52Q9+Ap9CPN5Jyy50CjdDRM7/Jjqfyxp7FUzYS9 N/8kh6iArciwy3i65Rz9EjJvOrZte6JolvXo2wDMMHyaD/sDZvwsSqBdTtWb3b3ZjC n1wdjjmlTuQBLdX0LENZgAdJY0kX5jcN/u/U3au6vQp3mXcXr40E/ayF8lB+w8LRKP X3V3idUo80N+u/0lVAJd15CTyz7IUuveau7jPrcpZr9yXFfpqiihGjMlcoxXUPBOca oh77A6aZ4lBOoau8+ePQOdSFzn/e/9G1xldNU/wVUcNBz5TqKWKi9tkzyzn/1PfWd/ 2W8IWkjphMvCw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 09/11] kbuild: remove the first line of *.mod files Date: Tue, 9 Jul 2019 13:24:13 +0900 Message-Id: <20190709042416.27554-10-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-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 current format of *.mod is like this: line 1: directory path to the .ko file line 2: a list of objects linked into this module line 3: unresolved symbols (only when CONFIG_TRIM_UNSED_SYMBOLS=y) Now that *.mod and *.ko are created in the same directory, the line 1 provides no valuable information. It can be derived by replacing the extension .mod with .ko. Cut the first line. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 4 ++-- scripts/adjust_autoksyms.sh | 2 +- scripts/mod/sumversion.c | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 1d01324455d1..f34f941c3b9b 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -281,7 +281,7 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) - @{ echo $(@:.o=.ko); echo $@; \ + @{ echo $@; \ $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) quiet_cmd_cc_lst_c = MKLST $@ @@ -463,7 +463,7 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \ + @{ echo $(filter %.o,$^); \ $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index d3561ff4089c..147de8908797 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -48,7 +48,7 @@ cat > "$new_ksyms_file" << EOT EOT sed 's/ko$/mod/' modules.order | -xargs -r -n1 sed -n -e '3{s/ /\n/g;/^$/!p;}' | +xargs -r -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 166f3fa247a9..63062024ce0e 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -398,7 +398,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) char *sources, *end, *fname; char filelist[PATH_MAX + 1]; - /* objects for a module are listed in the second line of *.mod file. */ + /* objects for a module are listed in the first line of *.mod file. */ snprintf(filelist, sizeof(filelist), "%.*smod", (int)strlen(modname) - 1, modname); @@ -407,13 +407,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) /* not a module or .mod file missing - ignore */ return; - sources = strchr(file, '\n'); - if (!sources) { - warn("malformed versions file for %s\n", modname); - goto release; - } + sources = file; - sources++; end = strchr(sources, '\n'); if (!end) { warn("bad ending versions file for %s\n", modname); From patchwork Tue Jul 9 04:24:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168702 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019256ilk; Mon, 8 Jul 2019 21:26:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqJc7xoIMvxTEF/S29LGYdwZq0qHowDg8jkksts0VNyAJBxiNP1AXuGSbybDw0KZmhr7wG X-Received: by 2002:a17:90a:4806:: with SMTP id a6mr30324227pjh.38.1562646364987; Mon, 08 Jul 2019 21:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646364; cv=none; d=google.com; s=arc-20160816; b=cPSg4ep86NdzAKKzBYL6T0c293owJGGh1rNHuR4yMqiMvIssasZBfk4FuruQweteGT fl6DhHIsVkAVwbG0KO1Os06ohuUDf6qb8gsq3P91zDqRbnCsGmGkzIsBDQlVvd6cFHmo G4byQqj68zy5kTZL9o9lH5JX/H7J9Ssq+GnnyRwrg02IwhxfLC03/wHAdjvR2UgtTnom ds1I/qMhtTd5fE6JeoBjz9BX+1SwSeeQYv8wLktohU7OPkpr0dO81YhtTlGE0hE5FKjJ QyUkRDPTT7SgSPaj+du9aEnE+0BMU56pwCUCx1xZjv23SDe7e6i5JH5uhxtcaBC1duym TvmA== 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=Ni4y2oebNHOHQ5sXkMzZTKtYKdCesevpzK3HSQMxIEc=; b=nNN2OWrcTFX0XlxOJ6UlHCYgPNmlyLUqBq7Pkxspck/HCcxyjrmXRaXRmaadjJaYg7 u0ivQHdvlSGwJKDeuvCd/aGcwu8rHp52hUdwVZHYzHV3MH3lc8yY/adtl1WaAu5/GNT4 6naONJm668GrYOSBbYVuqdkKwoYRJJVmPGour5qsWjHFAdzW2k3a4eQtlbR9eQcCL541 6Pz4xSeG6KxNsiwDELDDlHLkIkE1Jnu7QE0+gfRkkgyviQiPfYBsGvgLMtnJ59rKeBJo VmioAzJpbdBzreja27wpxCTOLKlQMYKgUY3VhAZmhnbk7Lb+b1J9typneyGkBXQXmZlh KN7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="cmv6j/7f"; 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 g129si22892964pfb.1.2019.07.08.21.26.04; Mon, 08 Jul 2019 21:26:04 -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="cmv6j/7f"; 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 S1727296AbfGIEZm (ORCPT + 30 others); Tue, 9 Jul 2019 00:25:42 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42170 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727072AbfGIEZl (ORCPT ); Tue, 9 Jul 2019 00:25:41 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVt009969; Tue, 9 Jul 2019 13:25:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVt009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646301; bh=Ni4y2oebNHOHQ5sXkMzZTKtYKdCesevpzK3HSQMxIEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmv6j/7fPBFB7YD9rBBeFwZRTZeF/9VDKux1wUFNDuzsd83v8LKHMuAxhZAtTIEjB O+rpw8gF7flTZ5Ov7UaQhAnAgt4TxFQPeTJ3IiMC1wg8Tg3B0x0MYwMHuZPd2sZAil i38VnjIH1AHpLxr8MYWLwEYy1RFApWLiVNg/QY8BBuBWSk0Dww7IVZTS0IH1dk25HX ZgDcb2awzx7zDZE+DfEvOMNCThSrFrwMo/eAhEZGEMv/lQIG0r7nLSx/43jcTDN5A0 2xJ3KFo0yqyVNmqmsODr54vinDz7VOVHdz+Wxm0Qf65j71iMlDVkt9iC8ydAt0HBzn RLxFJagwtdWxQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 10/11] kbuild: remove 'prepare1' target Date: Tue, 9 Jul 2019 13:24:14 +0900 Message-Id: <20190709042416.27554-11-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that there is no rule for 'prepare1', it can go away. Signed-off-by: Masahiro Yamada --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/Makefile b/Makefile index 958fafa605b9..b284863e7ea0 100644 --- a/Makefile +++ b/Makefile @@ -1094,7 +1094,7 @@ scripts: scripts_basic scripts_dtc # archprepare is used in arch Makefiles and when processed asm symlink, # version.h and scripts_basic is processed / created. -PHONY += prepare archprepare prepare1 prepare3 +PHONY += prepare archprepare prepare3 # prepare3 is used to check if we are building in a separate output directory, # and if so do: @@ -1111,10 +1111,8 @@ ifneq ($(srctree),.) fi; endif -prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \ - include/generated/utsrelease.h - -archprepare: archheaders archscripts prepare1 scripts +archprepare: archheaders archscripts scripts prepare3 outputmakefile \ + asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h prepare0: archprepare $(Q)$(MAKE) $(build)=scripts/mod From patchwork Tue Jul 9 04:24:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 168705 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8019383ilk; Mon, 8 Jul 2019 21:26:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9HVaRZv+LVFNCOkvD8AmvvL5PjZxoBtuntYG6W56ZGrbWrWlL34qbSlFHPfachEHxV9rq X-Received: by 2002:a65:6454:: with SMTP id s20mr28051756pgv.15.1562646374585; Mon, 08 Jul 2019 21:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562646374; cv=none; d=google.com; s=arc-20160816; b=CIG4sxoJGl9c2BG+ycA/xMHb8lu9f0PCEercOmvo5k0RRgD6TNj3/hudRB/cKyWm4v Uhop9lUPrOSIYmMIExOO8h0pHb4hK1UGZ1FBbE4+3afX+EkIpyqD6yVB/kN2HwR96Fmr yy/blPFKuEsGT4cwFK9Rc59a1G0kPhTbMI1ZEzcFaV0AImUYDvWx94Suw9ZEXaVphEm7 IPeUMbUrCJwh4VUBfoRNx9QFasrB9/UBN6ozU/I6iLHlSJRCmUGxr9fbtJhtxCPCffUd VVU+fM3u3y/Atu6ERK2N65nkGmMYMnc5dFDn4pxPKhKwDIqhBoFAt0xTwqJ4u2Ip/GoR ed6w== 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=RaJaeLmuuIEfd1ef6k7J45/hiRecyMkN2GAogQXZ22k=; b=v4e7VkfxAhl9h1UHaVhi3WtuEi/qH6WLlAbEFkYa3w8I9I4LDjItD9Qzrm2zO3Ij4M xN/k4f9EuXsJ3Gcgr3RO00LjhYHuQiddWwXr+xor5V8uFKgdXi8C7+wtLBjjAtYbpJN8 eQa4P1Zw+2EToYMq4sks5DyKxOLi5GeuXko8VGoPjk/WkluPhpIqOZEE9YSxDd+Ju9/9 /abwgpIHXIWcD4ECMftKsImM0Of40fSXEHwkLvWWLm++syZh66vum7eznPGwWXmE7DTp avsmrF91qsqUzD/A6jeQK1kjtmV92baHzxlhA7W883AwnLKBEw7St2u9/Wtad9OLmWHP rk7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uX7zdjII; 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 h69si21860993pge.543.2019.07.08.21.26.14; Mon, 08 Jul 2019 21:26:14 -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=uX7zdjII; 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 S1727582AbfGIE0M (ORCPT + 30 others); Tue, 9 Jul 2019 00:26:12 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:42157 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbfGIEZm (ORCPT ); Tue, 9 Jul 2019 00:25:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x694OqVu009969; Tue, 9 Jul 2019 13:25:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x694OqVu009969 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562646302; bh=RaJaeLmuuIEfd1ef6k7J45/hiRecyMkN2GAogQXZ22k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uX7zdjII0oCqxZzVB7KNqMSkUpgWJcg2+oGORop6+ZNSxaG2CYCOqh/GOR8icFu3Q CfiIsKHyRYYQu1fBH4ij4Te9U443p9CU77yeyG9VM29BMrhDBg7n81ewSihoBeAyFe 4U5zMONyEdv7cUg5/U6ehb9rwOypgnO+0H6ZNjqtDUMzuQLMvb78wqKD2w57Jgn7rb Q8WdH+Wmsq91Fc096FnuQ56/TDWP2UHmcVlXm+gRvSAFA2sGux17CyoZcHc3MxcZN5 YllouM6hj9oUsrjVuION2dLviX8+NEgx/CpHmhz8baLZrcGtvsQ16g+AOjdKGqxguZ W/D3cS1Q0Rf8g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nicolas Pitre , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 11/11] kbuild: split out *.mod out of {single, multi}-used-m rules Date: Tue, 9 Jul 2019 13:24:15 +0900 Message-Id: <20190709042416.27554-12-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190709042416.27554-1-yamada.masahiro@socionext.com> References: <20190709042416.27554-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, *.mod is created as a side-effect of obj-m. Split out *.mod as a dedicated build rule, which allows to unify the %.c -> %.o rule, and remove the single-used-m rule. This also makes the incremental build of allmodconfig faster because it saves $(NM) invocation when there is no change in the module. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f34f941c3b9b..00bd3bc1d6ba 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -69,8 +69,10 @@ modorder-target := $(obj)/modules.order endif endif +mod-targets := $(patsubst %.o, %.mod, $(obj-m)) + __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ - $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ + $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ $(subdir-ym) $(always) @: @@ -268,7 +270,7 @@ endef # List module undefined symbols (or empty line if not enabled) ifdef CONFIG_TRIM_UNUSED_KSYMS -cmd_undef_syms = $(NM) $@ | sed -n 's/^ *U //p' | xargs echo +cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo else cmd_undef_syms = echo endif @@ -278,11 +280,15 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) -$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE - $(call cmd,force_checksrc) - $(call if_changed_rule,cc_o_c) - @{ echo $@; \ - $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) +cmd_mod = { \ + echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ + $(cmd_undef_syms); \ + } > $@ + +$(obj)/%.mod: $(obj)/%.o FORCE + $(call if_changed,mod) + +targets += $(mod-targets) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ @@ -463,8 +469,6 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(filter %.o,$^); \ - $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-m)