From patchwork Tue Jun 7 05:18:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 69466 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1801551qgf; Mon, 6 Jun 2016 22:17:58 -0700 (PDT) X-Received: by 10.98.73.27 with SMTP id w27mr21456705pfa.137.1465276678218; Mon, 06 Jun 2016 22:17:58 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si31052994pay.144.2016.06.06.22.17.57; Mon, 06 Jun 2016 22:17:58 -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; 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 S1751559AbcFGFRt (ORCPT + 31 others); Tue, 7 Jun 2016 01:17:49 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:48673 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbcFGFRr (ORCPT ); Tue, 7 Jun 2016 01:17:47 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id u575H9co002634; Tue, 7 Jun 2016 14:17:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com u575H9co002634 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1465276630; bh=tyNWIzoYJaFcS0pBY+vBc2rlQ4776b/kzfDteqVWsaE=; h=From:To:Cc:Subject:Date:From; b=CJ+MvIiGa2wn02be8WJIseHX2SKY7mORyE3qj/M+Y1xZ9I0FWnakLHVILDRSCdLbi 01HvuWeWhJYeAPy2sL81oC0uzAirVWGjmyVCimFZxipPQUUMAc0eBQmTrrVsnUyK2o pENnRwPoMGweO5TzFKb1e4fa6F5XjLVXZPLHOtk2QDigu7Y09TU/+AR8Za4iB2TkJt txke44m0X1t578atNRcY1jsava9zp/NbVFyobv7iA90BU0NqfykjHOwEnGWIwmtYaN bP4oLarq2MRUYsltjjf7/M9unjVi845d6I7gua/jkkaL5suAdMSUMNdnwMwajsAVXY JmJqKOpCNUcZw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Rik van Riel , Paulo Zanoni , Michal Marek , Andrew Morton , Linus Torvalds , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: do not append NOSTDINC_FLAGS to avoid rebuild in package targets Date: Tue, 7 Jun 2016 14:18:01 +0900 Message-Id: <1465276681-23700-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For package building, the scripts/package/Makefile invokes "$(MAKE) KBUILD_SRC=", so the top Makefile is invoked recursively. Notice NOSTDINC_FLAGS is exported and assigned with "+=", not ":=". It means, NOSTDINC_FLAGS is accumulated in the call loop of package build: top Makefile -> scripts/package/Makefile -> top Makefile. Before, it was not a big deal because GCC just ignores the repeated compile options, and $(call if_changed,...) compared the old/new commands as a set of arguments. However, the situation was changed by commit 9c8fa9bc08f6 ("kbuild: fix if_change and friends to consider argument order"). Now Kbuild compares old/new commands more precisely. Since then, "make" followed by "make targz-pkg" always rebuilds the whole kernel. The NOSTDINC_FLAGS is added just once for "make", whilst twice for "make targz-pkg" as mentioned above. So, Kbuild considers that the build command has changed despite that we want a tarball straight away if everything is already built. The easiest way to fix this problem is to change "+=" to ":=" for NOSTDINC_FLAGS assignment. This effectively reverts commit e8f5bdb02ce0 ("[PATCH] Makefile include path ordering"). Its log says that the arch Makefile may override the include path order, but I see no arch Makefile touching NOSTDINC_FLAGS. So, this change should have no impact unless something outside of the kernel needs to override it. Reported-by: Paulo Zanoni Signed-off-by: Masahiro Yamada --- This patch is fixing the problem reported by: http://www.gossamer-threads.com/lists/linux/kernel/2454440 Paulo, Thanks for your report! Rik, This patch is reverting your commit applied more than a decide ago. As far as I see the kernel tree, I am not sure if it is still needed. I am not familiar with Xen at all, so your review is very appreciated. Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 diff --git a/Makefile b/Makefile index 8d1301a..58c06be 100644 --- a/Makefile +++ b/Makefile @@ -767,7 +767,7 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif # arch Makefile may override CC so keep this after arch Makefile is included -NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) +NOSTDINC_FLAGS := -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) # warn about C99 declaration after statement