From patchwork Thu Sep 12 07:33:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 173674 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1772899ilq; Thu, 12 Sep 2019 00:33:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwA4aLI+l3AoI9NSK6gt7jTGYUE8cyYCLZtx7QMr9cCm4ZHzIhpI3TWs/8Jp/5HW+wi57zJ X-Received: by 2002:a17:906:c799:: with SMTP id cw25mr16792077ejb.107.1568273632327; Thu, 12 Sep 2019 00:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568273632; cv=none; d=google.com; s=arc-20160816; b=cM8KVoZ3RwdZvAfJuvcSbQxHORDnoHMRkbzkO0XybFDfb75iygGYUHSuEbz9S2LcJr 2SMe4yrVTUAnmwEyQVerpv+5N+S69KYFqkh7MpNHgRPZtupohHaDmSZvWutbopaEkfBS boMWUiJN4IGQ4DzbU5QW/ScyWwjr4u1ts7w/s7iLwWi0t+6q7j8YlDbb2tAjw0qNmf2H OzQ7eBflkUlfe7YxshlfgT0FTxXmnJgKi69MLn28GSUZdf8eP3QhaMcLevo17ytJJbfZ QoCaMiPM2mleWJSqEUzaw01WSWmUlkcyXedhhuzBX7bxJaEeOHUEytR4HaaTjh37bIK0 YwuA== 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=G45NEfuMGe0ysBOraG5cU6KIy3gv/xwEFarEE/1Azn4=; b=uvgEJl2knjPCXgzKaaX1uHLaQkDOt5d1m6WeTJtv/VVeUtpPY1AFYbLG05U9tbu9dD GznyBxTkNID/YHx/xCZHi/SB1CHHw5UNRXAOARThkF7+T3L+utyvS97B1FUYj8IZLsVm nP2BnnqQzw5UFV7DbYmX0w1pGiEpnm8RCM33TqSB5QEHvfi7sFX7Nd0j14FTGGunPGEB LRJ99ny32dVlAeW3/z3QYP9vkum+g+RfWsObtuFDujJKu49qfrz68MzU85MGLmyTSN0Q cRtNQlTIvrQ/YmhqfXZtMTF2ApAbr0cEGEOxbRkYw9ZzM6NhJ9Pd+6lg0HVJegk6G2Bc ksPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nYZi0y5Z; 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 j12si12951984edn.348.2019.09.12.00.33.52; Thu, 12 Sep 2019 00:33:52 -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=nYZi0y5Z; 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 S1729883AbfILHds (ORCPT + 27 others); Thu, 12 Sep 2019 03:33:48 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:43160 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbfILHdr (ORCPT ); Thu, 12 Sep 2019 03:33:47 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x8C7Xbg9018895; Thu, 12 Sep 2019 16:33:39 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x8C7Xbg9018895 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568273619; bh=G45NEfuMGe0ysBOraG5cU6KIy3gv/xwEFarEE/1Azn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nYZi0y5Z0dJ+Wz9a0/lEP2LGcyWK4k8zCXSa3YBUTLoEOIcpXhE6OZnb1TEYGDMls I6797JLQDUDiBeaI/5C/SN+hxqQsPSjEtecK2LMwxz/ihNk0JVapSBsaCPxFlFXKuB AR+Eejw+0aUwu+hLPhEWQID67d1+E/d9wyQNCOigNR9unRDU22oniGucgR2+/g7mCF 8qcyPKhdTFI40W+9c6aCAZUAv5aW33fgmDGxxRhaKD61BKtnoigWiEg94mISV4ivlY jS5fo5IvmFXvjBxx+pgJ/cz3msXVmjWnsAumeZRkgrVhYIwC6oPE+XnhYUEotAjYD1 QH1pnP3A7kj+w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] kbuild: warn orphan obj-y objects Date: Thu, 12 Sep 2019 16:33:34 +0900 Message-Id: <20190912073336.7036-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190912073336.7036-1-yamada.masahiro@socionext.com> References: <20190912073336.7036-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 easy to notice. This commit provides build-time warning. I tested allmodconfig based on v5.3-rc4, and I saw one warning: scripts/Makefile.build:57: '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. sound/soc/sprd/sprd-mcdt.o is not linked to vmlinux. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 6 ++++++ scripts/link-vmlinux.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 54fc68168686..d30b04707fec 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -52,6 +52,12 @@ ifndef obj $(warning kbuild: Makefile.build is included improperly) endif +ifeq ($(need-builtin),) +ifneq ($(real-obj-y),) +$(warning '$(real-obj-y)' will not be linked to vmlinux even though obj-y is specified.) +endif +endif + ifeq ($(need-modorder),) ifneq ($(obj-m),) $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.) 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