From patchwork Tue Mar 13 06:11:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10277793 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 84834602BD for ; Tue, 13 Mar 2018 06:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8569328B76 for ; Tue, 13 Mar 2018 06:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 742D428B9D; Tue, 13 Mar 2018 06:12:49 +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=unavailable 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 92FEE28B76 for ; Tue, 13 Mar 2018 06:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbeCMGMA (ORCPT ); Tue, 13 Mar 2018 02:12:00 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45705 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbeCMGL5 (ORCPT ); Tue, 13 Mar 2018 02:11:57 -0400 Received: by mail-pl0-f68.google.com with SMTP id v9-v6so10761963plp.12 for ; Mon, 12 Mar 2018 23:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P9n0ZqGjcwzSlsW0NHNwn2ssnLqyO4lcPwx7ieSDA44=; b=lAuLpGNLgs7Gjp76A8Xxq3+x6s63evWuD5fysH4qOLNyHnKXmfqrDzB162hMZKdqy0 A8qcgkmR1URj70FqwX1QAeKs4zujPJliCpgCnaVa68UM1p6WIfpCvxMUNI1YQ5rjGkf6 FXjcBRea+c1paqzVmT2Bw8WnEfiyciSW8pQZk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P9n0ZqGjcwzSlsW0NHNwn2ssnLqyO4lcPwx7ieSDA44=; b=mY1JBhAvXwl1dIB2PQNVHzbWuugp4baYFBXeQsN21+CabgmFCfFcQwYUGyp7E0//ny AyicVDiVp/Ejz5G+lTKHKoQStMl/wYRrpdmmNxL+YMO0+Qx98jUTtde617X1BWcgh1gp 84ze4rV/B9WiLSNzr5U2U9ZYRWkiDXf1rIZZ1++nboHeAYtT8VFQMYQHeke1/PkY7sNX uagimp5Bz65TiFpq+aAbpYjpZOPZfHhWt7/Ln21XrVVMCkfOKY3op3mT69AZyp9QY206 /k8N0tPn9UjUcD9B9E1f5SUNaNPN2zMuxMZKcAS8NDiqkydeAgy2eJeouOcZ/N8ofGqR tBhQ== X-Gm-Message-State: AElRT7FXb1TBFLLIPJpPsjt43AOAlIgY5RsOJu1bPKDw6BMR4oS384LV +jnzhoQ4AaGDv+yEPOsu8UGuJw== X-Google-Smtp-Source: AG47ELvD3CCz8HwKhyN/GpT6L1SRtsjNkfqsYmEhYMR8dS+LMXLZlP/5pZEYa2yMZurb220MuUoEFg== X-Received: by 2002:a17:902:7d88:: with SMTP id a8-v6mr5648581plm.283.1520921516788; Mon, 12 Mar 2018 23:11:56 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:0:1000:1511:bde7:107f:fd5:44c8]) by smtp.gmail.com with ESMTPSA id c67sm20933553pfl.106.2018.03.12.23.11.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 23:11:55 -0700 (PDT) From: Douglas Anderson To: Masahiro Yamada Cc: malat@debian.org, dave.hansen@intel.com, yang.s@alibaba-inc.com, linux@roeck-us.net, Douglas Anderson , Michal Marek , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH v3 1/2] kbuild: Require a 'make clean' if we detect gcc changed underneath us Date: Mon, 12 Mar 2018 23:11:08 -0700 Message-Id: <20180313061109.72629-2-dianders@chromium.org> X-Mailer: git-send-email 2.16.2.660.g709887971b-goog In-Reply-To: <20180313061109.72629-1-dianders@chromium.org> References: <20180313061109.72629-1-dianders@chromium.org> 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 Several people reported that the commit 3298b690b21c ("kbuild: Add a cache for generated variables") caused them problems when they updated gcc versions. Specifically the reports all looked something similar to this: > In file included from ./include/uapi/linux/uuid.h:21:0, > from ./include/linux/uuid.h:19, > from ./include/linux/mod_devicetable.h:12, > from scripts/mod/devicetable-offsets.c:2: > ./include/linux/string.h:8:20: fatal error: stdarg.h: No such file or > directory > #include Masahiro Yamada determined that the problem was with: NOSTDINC_FLAGS += -nostdinc -isystem $(call shell-cached,$(CC) -print-file-name=include) Specifically that the stale result of -print-file-name is stored in the cache file. It was determined that a "make clean" fixed the problems in all cases. In this particular case we could certainly try to clean just the cache when we detect a gcc update, but it seems like overall it's a bad idea to do an incremental build when gcc changes. We should warn the user and tell them that they need a 'make clean'. Fixes: 3298b690b21c ("kbuild: Add a cache for generated variables") Reported-by: Yang Shi Reported-by: Dave Hansen Reported-by: Mathieu Malaterre Signed-off-by: Douglas Anderson --- Changes in v3: - Fix as per Masahiro Yamada (move change to main Makefile) Changes in v2: - Don't error if MAKECMDGOALS is blank. Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index c4322dea3ca2..f1e61470640b 100644 --- a/Makefile +++ b/Makefile @@ -573,6 +573,15 @@ virt-y := virt/ endif # KBUILD_EXTMOD ifeq ($(dot-config),1) +# Require a 'make clean' if the compiler changed; not only does the .cache.mk +# need to be thrown out but we should also start with fresh object files. +cc-fullversion-uncached := \ + $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh -p $(CC)) + +ifneq ($(cc-fullversion-uncached),$(cc-fullversion)) + $(error Detected new CC version ($(cc-fullversion-uncached) vs $(cc-fullversion)). Please 'make clean') +endif + # Read in config -include include/config/auto.conf