Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1877437ybe; Thu, 12 Sep 2019 00:35:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx04gcwuh0N+AVfnhcDsd4olhacXPvSsbjdoHigiSYYmCkig7B9UuUyrjaSqDoYUNwLDTlN X-Received: by 2002:aa7:d2cd:: with SMTP id k13mr8680492edr.28.1568273756581; Thu, 12 Sep 2019 00:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568273756; cv=none; d=google.com; s=arc-20160816; b=GJ1Cc6Gn4EFAlkZ5O4R7YQqU4kyU/L/hAdWL37v3ls7g05Z/wBWAP1sS8vgltVVOQP 8/Xj3FThaWOVTVXIso3ybpK7TSHdZAH1pgYeaDd1ltjnDTGyRz75ddx19h3cxXGsPmTw 7o5Jxxn8ERJE0roFTsCkVMUAG9XssMaYK6RV5j5/yfsGaa83NA6CCR1BGProOexTeMQW kLoO/uYngbuh5QbU1/ct/sCxJMNvyy6e+vumCpJlC5emuni14BXY0X3FfJShmi+qqOhA 9ybO6kcqx4B8PEmHq4aqQ7tCHGFzVaR+7KGqMnBbgbrtlWOjGJ4E6kOMVqS2dyY39TWe 525A== 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 y17si13296052edo.354.2019.09.12.00.35.33; Thu, 12 Sep 2019 00:35:56 -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 S1729825AbfILHds (ORCPT + 99 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(-) 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 -- 2.17.1