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: 9159863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C06D160572 for ; Tue, 7 Jun 2016 05:17:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B509427248 for ; Tue, 7 Jun 2016 05:17:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A94992833E; Tue, 7 Jun 2016 05:17:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3CBC27248 for ; Tue, 7 Jun 2016 05:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751322AbcFGFRs (ORCPT ); Tue, 7 Jun 2016 01:17:48 -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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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