From: Douglas Anderson <dianders@chromium.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: malat@debian.org, dave.hansen@intel.com, yang.s@alibaba-inc.com,
linux@roeck-us.net, Douglas Anderson <dianders@chromium.org>,
Michal Marek <michal.lkml@markovi.net>,
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 [thread overview]
Message-ID: <20180313061109.72629-2-dianders@chromium.org> (raw)
In-Reply-To: <20180313061109.72629-1-dianders@chromium.org>
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 <stdarg.h>
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 <yang.s@alibaba-inc.com>
Reported-by: Dave Hansen <dave.hansen@intel.com>
Reported-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
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
--
2.16.2.660.g709887971b-goog
next prev parent reply other threads:[~2018-03-13 6:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 6:11 [PATCH v3 0/2] kbuild: Fix corner caches with .cache.mk Douglas Anderson
2018-03-13 6:11 ` Douglas Anderson [this message]
2018-03-13 6:11 ` [PATCH v3 2/2] kbuild: Don't mess with the .cache.mk when root Douglas Anderson
2018-03-13 6:16 ` Ingo Molnar
2018-03-13 6:23 ` Doug Anderson
2018-03-13 16:33 ` Nick Desaulniers
2018-03-13 16:44 ` Doug Anderson
2018-03-13 17:39 ` Linus Torvalds
2018-03-13 23:42 ` Doug Anderson
2018-03-14 7:23 ` Ingo Molnar
2018-03-14 8:30 ` Peter Zijlstra
2018-03-13 7:49 ` [PATCH v3 0/2] kbuild: Fix corner caches with .cache.mk Masahiro Yamada
2018-03-13 16:37 ` Doug Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180313061109.72629-2-dianders@chromium.org \
--to=dianders@chromium.org \
--cc=dave.hansen@intel.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=malat@debian.org \
--cc=michal.lkml@markovi.net \
--cc=yamada.masahiro@socionext.com \
--cc=yang.s@alibaba-inc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox