From patchwork Thu Sep 12 16:22:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 173718 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2360803ilq; Thu, 12 Sep 2019 09:23:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzbaJJpTllH9wAFBAnUJtAK6otoR/ImQTy6dYQCa1EdRB+JRZyWOnpPkZzkWyGoW+HZZFT X-Received: by 2002:a50:9f42:: with SMTP id b60mr44006001edf.192.1568305394214; Thu, 12 Sep 2019 09:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568305394; cv=none; d=google.com; s=arc-20160816; b=wdAVFrRgrAqCp5zoDrgeVlM8MN4C3HIn2cehaa6+lKreC80Rloys1ugfi5tGRaHzVl AYXUGKD7DgPlXQlp5VY6Cp539i5osUm8cpw4+HkxXcVxNONX4CnrdnzwB5p58OhBipPW DSywNatVLtsMwRNY/xCjPLHBTmPe0LDUaaUzq1lKPwJTNZBAlYvjT8OeLDs3tVx41m/d uNqbbB5Z+Ix2RRGmsycpNIu6TvSJ2/6CWuWV+vOKLA6jSZxTXMcFydcXIyQIqSK487nS NWxDaAYSdoWqIW0mipiY0MDtGdzIDUkCzMXW2DXNszjd5hCjjHEX7WWC1qxNBdJUiqsn 8Ktg== 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=BmLOVqV59Vde6VCUiKEZh8rSQkSRAqH6r3P6Fy5+ico=; b=FPiZZsHnaaq9SCBnPQrLtEzUJNBUi1WEx8JedWZptTdeXdP4Mje5mvWqskbHJ0AuHm mBrbeCU6TN2vyTkcu93KNqG+K0KCz3kd1Wh/zBnwL53ob/KpDUWolh3gFPliwD3vNMH8 e/I35pKaqsGY0/5G2xof3kOsgI0ugWzy20Hgf1ROG+jCLd5EcV/sOIISen60A/YvgSbG f2BE3tTAktFjrfM6r2UNM6uHQhudbMTTqk2eivRXv1dEf45QDHeNKZsmYXWAI2Z7YKV2 VLunBoGNUMXVGqdtxKHXYbT1Y2CU3nVr6yp1pYldZDTxYGnQoddSXUX9oEw1rCc45eLf NZ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GnQyqTru; 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 t6si13274195ejr.238.2019.09.12.09.23.13; Thu, 12 Sep 2019 09:23: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=GnQyqTru; 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 S1733172AbfILQXK (ORCPT + 27 others); Thu, 12 Sep 2019 12:23:10 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:42379 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfILQXJ (ORCPT ); Thu, 12 Sep 2019 12:23:09 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-07.nifty.com with ESMTP id x8CGMu1a021030; Fri, 13 Sep 2019 01:22:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x8CGMu1a021030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568305377; bh=BmLOVqV59Vde6VCUiKEZh8rSQkSRAqH6r3P6Fy5+ico=; h=From:To:Cc:Subject:Date:From; b=GnQyqTruc2er6tX9zm3L1Y8mJnaZMNKoOWR/d2UdtM6d2gyz+Pau5nORNcdL02lRv 4k/JzXU3PCw05eKfBmeIca8gG+UyhW8NbP0vjSaiMgPDTk05pp5hhsJ1zu9RAc3U9a 4747NrEfj8fvjq/pF7rJuc50NtedlcNgZUohOGvWFNqLBmt9wEAag4P8a7PLxcfXCW +WvYTw7Hr9k+vRSVcdg+wgtXuutPKe/cQVBTNH2GBLuDNErcl+jIcKUPMfAH65Pjck y8B/+PP7wz3s/UNrTCjzj0MekA112JwcvbJysyZiCPAC7PMGOfsYZ2Zqpjgxxi+9w7 drF3nnfsDCz1A== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] kbuild: do not create built-in.a that is never linked to vmlinux Date: Fri, 13 Sep 2019 01:22:51 +0900 Message-Id: <20190912162254.9603-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 Both 'obj-y += foo/' and 'obj-m += foo/' requrest Kbuild to visit the sub-directory foo/, but the difference is that only the former combines foo/built-in.a into the built-in.a of the current directory because everything in sub-directories visited by obj-m is supposed to be modular. So, it makes sense to create built-in.a only if that sub-directory is reachable by the chain of obj-y. Otherwise, useless orphan built-in.a files are generated. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 2 +- scripts/Makefile.lib | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f72aba64d611..6c3e6cb0c0af 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -66,7 +66,7 @@ lib-target := $(obj)/lib.a real-obj-y += $(obj)/lib-ksyms.o endif -ifneq ($(strip $(real-obj-y) $(need-builtin)),) +ifdef need-builtin builtin-target := $(obj)/built-in.a endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4a0cdd6f5909..26ac638525cb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -35,7 +35,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) subdir-m += $(__subdir-m) +ifdef need-builtin obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) +else +obj-y := $(filter-out %/, $(obj-y)) +endif obj-m := $(filter-out %/, $(obj-m)) # Subdirectories we need to descend into From patchwork Thu Sep 12 16:22:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 173719 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2360818ilq; Thu, 12 Sep 2019 09:23:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEjRKkfwrM0i5vn8Y00ZynE+LUwW/ryTjyzt0uXYUgwLT0JUFfa2fR0loucmgx+YPFr1Oy X-Received: by 2002:a17:906:390c:: with SMTP id f12mr35462351eje.153.1568305394905; Thu, 12 Sep 2019 09:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568305394; cv=none; d=google.com; s=arc-20160816; b=PvpcNn3kKN52gvmq48NbmnIPz/TX7BxzQU/bJ2+RW7lQM4bDHX3OJHEV9g7NxYba+X MBuvNi4N/W4b3U4ZJSyAVn879WVchuamxcLpWgB+t6yF95Bzm0csIcaRH0CbXOmmU56g rlW8rzgF80WtPXRx10QFYks+L3wnqxHbs9Zoy/ZFR4CUjce3i6FJwgI0QF48+XakZt2I obALWC1zj0cp2F5LMJcrBCtgyLFkCXNQiKVz099CRuDWrYBNdoKjFvpMntR6qqYvPNwt FQDmIDSdmfc6eyXniy8b3yNLmzBxnm6KclK/n0YP188oo6W/MRvrgR0fMt43z2g/Hh+g XF4Q== 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=ODIkurWAfHrOiVaGlkYrz/KE7y0sW22uQuzTjixHoH8=; b=MwI3kr/bPBZi/J6t+XZUbvIPRNnJDHK5veUb6u+bY7wrsF171tYTkAIZsYjlUWlb1m MDPRihGmlNn91NFEefT2J281AqehaqBCvO9f+XiCGA1zMoIjPyNWde+Ml9aZZZgT09iv 5x1lbLticD43Bz8C0pYRp2M3hwC6gdxuaD74Q801iBemd7NwMew1+HYA7pASHZ6P250F 1c5KzsX/t3fitvcWV3lbANAfYGnq7nUfSsvYbpGmw4Gwx9i2s/PnmAnvwGLozqU1Mnkq tTkBvVrQx/3r+/GmatHL/gL1IheZjvUi3oxlr7fu1czczFx4C3u8tnkuKlOmg06/4kSm MFTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Ccvw0IiV; 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 t6si13274195ejr.238.2019.09.12.09.23.14; Thu, 12 Sep 2019 09:23: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=Ccvw0IiV; 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 S1733185AbfILQXL (ORCPT + 27 others); Thu, 12 Sep 2019 12:23:11 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:42383 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730132AbfILQXJ (ORCPT ); Thu, 12 Sep 2019 12:23:09 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-07.nifty.com with ESMTP id x8CGMu1b021030; Fri, 13 Sep 2019 01:22:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x8CGMu1b021030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568305377; bh=ODIkurWAfHrOiVaGlkYrz/KE7y0sW22uQuzTjixHoH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ccvw0IiV5YLTG5lkl7gvdD9ne+M3KJmq27iAmX6sFJ2q5bNgwy/iN48SwURh9Wrmr qrTMWCM4CnFJY/rM7iAPE+y+/riADB6fBeCvgED9NOrfPO0uymNHaqeUjkf0/G+o60 9HnU2Hhvkl18tu9boSA7o0xKBktXDXnQcdyIcXx7NDNMJ9nUfniPCAz1IHJ4CYs+vb ft+H2Dfv/c5pl+gnaep5Fk7VQCcTdsqfdH75q/In2PIjY78X0Meu5MXEa2/xN2xB6M 7ruAy1VSYuo/PEIuQ/LnfA/4Rpt0pL/mML9m1YXoRj0TWMQsF1Zq8H7qdWVSr/qmuG CmlvJwC+hUoHQ== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] kbuild: warn orphan built-in objects Date: Fri, 13 Sep 2019 01:22:52 +0900 Message-Id: <20190912162254.9603-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190912162254.9603-1-yamada.masahiro@socionext.com> References: <20190912162254.9603-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org obj-y specifies objects linked into vmlinux, but they are actually linked if and only if that sub-directory is visited by the chain of obj-y. If you have an orphan obj-y object, it is a bug, but may not be easy to notice. This commit provides build-time warning. I tested x86 allmodconfig based on v5.3-rc4, and I saw one warning: warning: 'sound/soc/sprd/sprd-mcdt.o' will not be linked to vmlinux even though obj-y is specified. This is a proper warning. sound/soc/sprd/sprd-mcdt.o is compiled as built-in since CONFIG_SND_SOC_SPRD_MCDT is boolean. However, CONFIG_SND and CONFIG_SND_SOC are tristate, and set to m by allmodconfig. So, Kbuild descends into sound/soc/, then sound/soc/sprd/ by obj-m. Thus, sound/soc/sprd/sprd-mcdt.o is not linked to vmlinux. More warnings for arm allmodconfig, all of which are valid: warning: 'drivers/video/fbdev/mmp/hw/mmp_ctrl.o' 'drivers/video/fbdev/mmp/hw/mmp_spi.o' will not be linked to vmlinux even though obj-y is specified. warning: 'drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.o' will not be linked to vmlinux even though obj-y is specified. warning: 'sound/soc/pxa/mmp-pcm.o' will not be linked to vmlinux even though obj-y is specified. Signed-off-by: Masahiro Yamada --- Changes in v2: - fix false-positive warning for arm64 scripts/Makefile.build | 12 ++++++++---- scripts/link-vmlinux.sh | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 6c3e6cb0c0af..fb29c898604a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -52,6 +52,10 @@ ifndef obj $(warning kbuild: Makefile.build is included improperly) endif +PHONY += __warn-orphan-obj-y +__warn-orphan-obj-y: + @echo "warning: $(patsubst %,'%',$(real-obj-y)) will not be linked to vmlinux even though obj-y is specified." >&2 + ifeq ($(need-modorder),) ifneq ($(obj-m),) $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.) @@ -68,6 +72,8 @@ endif ifdef need-builtin builtin-target := $(obj)/built-in.a +else ifneq ($(real-obj-y),) +builtin-target := __warn-orphan-obj-y endif ifeq ($(CONFIG_MODULES)$(need-modorder),y1) @@ -386,16 +392,14 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; # # Rule to compile a set of .o files into one .a file (without symbol table) # -ifdef builtin-target quiet_cmd_ar_builtin = AR $@ cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) -$(builtin-target): $(real-obj-y) FORCE +$(obj)/built-in.a: $(real-obj-y) FORCE $(call if_changed,ar_builtin) -targets += $(builtin-target) -endif # builtin-target +targets += $(obj)/built-in.a # # Rule to create modules.order file diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 2438a9faf3f1..8961d999b86b 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -216,7 +216,7 @@ else fi; # final build of init/ -${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init +${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1 #link vmlinux.o info LD vmlinux.o From patchwork Thu Sep 12 16:22:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 173717 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2360795ilq; Thu, 12 Sep 2019 09:23:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPUec7j+0BXqqRjNClHaDgHzsmtN1o9rYqYvDv6SC41FPGzQ83o3XpXNeAWUXZyMmZd3hd X-Received: by 2002:aa7:dac5:: with SMTP id x5mr43443540eds.290.1568305393661; Thu, 12 Sep 2019 09:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568305393; cv=none; d=google.com; s=arc-20160816; b=HotpfofHTMznpHwir+IH94W0i1xBkYyedwjZ5xR8VDukuruXGXHuDhPKZR5SrSkq1B aEPxzz3s3r7kg7+npfP9FPWuDzx4c0i4MkvHtX5azVbapILifUZDI6PZ4rkoVQ/mJUUO HL3S7V33ZkVZzafhYQHKK/+Bws7rnTRPah/LE/3Z0O9R1Owj1LviQTOElkm+tmqY5g5S P4xw9JZc6URT0IirqueE2/7lA5yHPFxRq/lbO0O/Qa6VHwAzJAYF5Ap+Tn3L55crMr/T CJ4Bq+IB+DnC3C8y41aB+6lC5cSKAnXu7Q+7tss0VV453DnUA8rAHFvCpbPkAIonKXCy CFeg== 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=6plTsXg4MpJ2Euqlmtft3yphP/1mbsQxTTVwZlEiA3Y=; b=TneY58OTpUm/ms08T2e4zWYlXPreqtAZUSUYBTU94Oed8DBx1RmDkEEmffMzN33juN 2IRpHerw+yq95RerNTBxZtrh7sOZfWHhKEw+22Nh4/BrPOT4U2teJQy7/buEtMBhNYAh Hji3Mf2aEHLrRQlA8hzrBrJJbI9/0FcjABAt3ECbrosfWdlxsDlyEa+Tph2q3X1K8ktU EsRU8hdj6QA+4U7NMGzpNg8bJG9oNjIrJkBeaU0gzZwJJmLzri8zdCHbwurG/KCsH17g 9GgUkBByRh2iHdKbsnkAofNBKz1b7KxBffjQ+Aid9d8GLsU2EtPJ/uhD7bMofhOk/Inl o4Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=eoiAXkw0; 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 t6si13274195ejr.238.2019.09.12.09.23.13; Thu, 12 Sep 2019 09:23:13 -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=eoiAXkw0; 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 S1733160AbfILQXJ (ORCPT + 27 others); Thu, 12 Sep 2019 12:23:09 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:42382 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730119AbfILQXJ (ORCPT ); Thu, 12 Sep 2019 12:23:09 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-07.nifty.com with ESMTP id x8CGMu1c021030; Fri, 13 Sep 2019 01:22:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x8CGMu1c021030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568305378; bh=6plTsXg4MpJ2Euqlmtft3yphP/1mbsQxTTVwZlEiA3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eoiAXkw0USezn6DqskoWpLU4Wu99H8g65BJXxSJgJcWFhRzBxcYfOtN8UiNkgdSEx rKHMksnmO0e86RdXD/wNp4bfcStkLx805BLRHtF3cC7oup7a/a83uh1OS9n+4UCI2I 7P6OoI5nOsgNgJPLYnIETDEAVY1LqUI/vGA/IW9UHgR0+BqyJipu2Q8IFD3aKK6wUr qYEw/jkRnuhvrCwW1+9uU/r6pKwFjQg/bOWQAMM9blWIgg4cJy791/jtci8yQTcpTl akRCKJLNkpw1qBXEwF5tff/buTxKBfOJDfKgT5wyf2X+xSZuX8kgTAASk522MazwLC vW/GqDUCxrJEQ== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] kbuild: clear KBUILD_MODULES in top Makefile if CONFIG_MODULES=n Date: Fri, 13 Sep 2019 01:22:53 +0900 Message-Id: <20190912162254.9603-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190912162254.9603-1-yamada.masahiro@socionext.com> References: <20190912162254.9603-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not try to build any module-related artifacts when CONFIG_MODULES is disabled. Signed-off-by: Masahiro Yamada --- Changes in v2: - New patch Makefile | 4 ++++ scripts/Makefile.build | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/Makefile b/Makefile index adc0cabe2382..0ecc62dbe234 100644 --- a/Makefile +++ b/Makefile @@ -1797,6 +1797,10 @@ single-build = $(if $(filter-out $@/, $(single-no-ko)),1) endif +ifndef CONFIG_MODULES +KBUILD_MODULES := +endif + # FIXME Should go into a make.lib or something # =========================================================================== diff --git a/scripts/Makefile.build b/scripts/Makefile.build index fb29c898604a..aab9a14fa78d 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -76,7 +76,7 @@ else ifneq ($(real-obj-y),) builtin-target := __warn-orphan-obj-y endif -ifeq ($(CONFIG_MODULES)$(need-modorder),y1) +ifdef need-modorder modorder-target := $(obj)/modules.order endif From patchwork Thu Sep 12 16:22:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 173720 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2360925ilq; Thu, 12 Sep 2019 09:23:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOtAlKL1Sp19a2YoSVNzzdbt9nE8cAhvw2w45a7rH5oDhMDnJYCOnoLFU9rD8Aj/vajBuu X-Received: by 2002:a50:99da:: with SMTP id n26mr26873223edb.293.1568305400807; Thu, 12 Sep 2019 09:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568305400; cv=none; d=google.com; s=arc-20160816; b=Z89KaEQtylCrqCh4GYcOMRQ7qMPTqbtJeAqjLzLsWtshHShGzi9JiGTGOCsTitVuIX 8+2tkMIQyW/doPgXwCJssB8C3Wal5LTQg6qjwQCicjrWCBSIEIa0X0bZ2yEfDOM0OaQO mKWSIEU1OSfaXVRmGy2iLEzqAlDe2rQKtmTeil9hyGhjoIZd4GU8UAh39ncyIT9zfJ3i ujZydWExiVv8rDqLWjl0MTBGm44JDxyIFBnYbVRzL8PKdnSy/AeuhhnYIiNjE0ISYpgT oW090a5/bsSD0DF+fY/a1cIULNE55SOykkEvjX6EwMaCLo5L8L4ZeSCXUwSahzNmzs3o k2VQ== 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=425q+EI5prUG/76w/vzMZUodVpls78ES9Ka+fZC1U8Y=; b=ypPrdPvWtjlEDfHU35F/k84YbkuQ2r52q+yfJS0OV2FECv8J+Fci+WDSF3JvD97N4j zP0sN6bcbzupc7Ja+4YHbKVNuFWK1jCAlZ5Hy+wdei/q0YLPbIuJntyHhTfqoazCbM2s MP6hzPSIKOe608V5/OjlYTNHN9++jOm5z2xbbQzR8ELh8Jmcbs38yGpIb/EueymvSw61 GRMrFC/qNdm2ccblxWXSqKpIfF3QLZ8+o03CeelXFLzThHg9bgfXVzOIGXyY9mAnhqGb yXCIn+MO701YT9iTvc2wFQ6NYJwEhrC+RErOqH8GMWE35SzshDq/gJNogIxvoIdBOhB9 ojqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=fDc8man5; 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 qc15si13258262ejb.255.2019.09.12.09.23.20; Thu, 12 Sep 2019 09:23:20 -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=fDc8man5; 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 S1733197AbfILQXQ (ORCPT + 27 others); Thu, 12 Sep 2019 12:23:16 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:42374 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730084AbfILQXK (ORCPT ); Thu, 12 Sep 2019 12:23:10 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-07.nifty.com with ESMTP id x8CGMu1d021030; Fri, 13 Sep 2019 01:22:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x8CGMu1d021030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568305378; bh=425q+EI5prUG/76w/vzMZUodVpls78ES9Ka+fZC1U8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDc8man5VLLG93SfmFUxF2BcK8iikJO5UAmxbutIQC5+XCBt65sE38cTuXnLzBfLe gHt/HeBfMUTxTjiDlZ+hHHDiZLUbY01HZbl18o66yaFGD+z7MzK/R0iazfaIrjvwcF 2N2VsAnIMo18pTdxPWNNTc9xNeB7gfTo/oLnUwY2If4shzFug59r8IvTnwrsBsqe49 hCmxDc3ikTQtMbDSFYPWcpm0cUw0PY/vnTMcA2/g5VeuapOffOBr3GTQYods3JT0J9 w1y44FppyDt0hYuAqG5Qkljnbhx8Nar2p2Xtsr/lPeEA+STcmzmSU0Dk5U/EMgYKM6 vbwQ8lA8NGf7g== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] kbuild: change need-modorder implementation slightly Date: Fri, 13 Sep 2019 01:22:54 +0900 Message-Id: <20190912162254.9603-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190912162254.9603-1-yamada.masahiro@socionext.com> References: <20190912162254.9603-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Align with the need-builtin implementation. I also added need-modorder=1 to scripts/link-vmlinux.sh to make it more future-proof; currently, we have no module in the init/ directory, but if we had a one, scripts/Makefile.build would show a false positive warning. Signed-off-by: Masahiro Yamada --- Changes in v2: - do not show orphan obj-m warning unless you are building modules scripts/Makefile.build | 16 ++++++++-------- scripts/Makefile.lib | 2 ++ scripts/link-vmlinux.sh | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index aab9a14fa78d..3b04ff23deb1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -56,12 +56,10 @@ PHONY += __warn-orphan-obj-y __warn-orphan-obj-y: @echo "warning: $(patsubst %,'%',$(real-obj-y)) will not be linked to vmlinux even though obj-y is specified." >&2 -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 +PHONY += __warn-orphan-obj-m +__warn-orphan-obj-m: + @echo "warning: $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified." >&2 + @echo "warning: You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead." >&2 # =========================================================================== @@ -78,6 +76,8 @@ endif ifdef need-modorder modorder-target := $(obj)/modules.order +else ifneq ($(obj-m),) +modorder-target := __warn-orphan-obj-m endif mod-targets := $(patsubst %.o, %.mod, $(obj-m)) @@ -406,7 +406,7 @@ targets += $(obj)/built-in.a # # Create commands to either record .ko file or cat modules.order from # a subdirectory -$(modorder-target): $(subdir-ym) FORCE +$(obj)/modules.order: $(subdir-ym) FORCE $(Q){ $(foreach m, $(modorder), \ $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ | $(AWK) '!x[$$0]++' - > $@ @@ -513,7 +513,7 @@ $(subdir-ym): $(Q)$(MAKE) $(build)=$@ \ $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \ need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) \ - need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1)) + need-modorder=$(if $(filter $@/modules.order, $(modorder)),1) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 26ac638525cb..23e524027740 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -23,7 +23,9 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # Determine modorder. # Unfortunately, we don't have information about ordering between -y # and -m subdirs. Just put -y's first. +ifdef need-modorder modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) +endif # Handle objects in subdirs # --------------------------------------------------------------------------- diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 8961d999b86b..d9edfba54d84 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -216,7 +216,7 @@ else fi; # final build of init/ -${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1 +${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1 need-modorder=1 #link vmlinux.o info LD vmlinux.o