aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-29 23:12:12 +0100
committerSam James <sam@gentoo.org>2022-09-29 23:35:57 +0100
commit3e49f724d090d65b739be1a67f6c40574337a2f7 (patch)
treebc8895dc704874167426f514582485e2b063ba64 /gcc-config
parentgcc-config: improve language (diff)
downloadgcc-config-3e49f724d090d65b739be1a67f6c40574337a2f7.tar.gz
gcc-config-3e49f724d090d65b739be1a67f6c40574337a2f7.tar.bz2
gcc-config-3e49f724d090d65b739be1a67f6c40574337a2f7.zip
gcc-config: set CCACHE_COMPILERCHECK to major GCC version
This avoids invalidating caches on every GCC snapshot bump for the same major version (e.g. 12.2.1_p*), but also for 12.1 -> 12.2. It should be fine to mix objects between such versions. If needed, we can swap this to just stripping .1_p* but that's a bit more awkward. Bug: https://bugs.gentoo.org/872971 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'gcc-config')
-rwxr-xr-xgcc-config8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc-config b/gcc-config
index 44a3869..dfc01d0 100755
--- a/gcc-config
+++ b/gcc-config
@@ -747,6 +747,14 @@ switch_profile() {
echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
fi
+ # Avoid ccache cache invalidations where possible between
+ # snapshots and minor GCC versions, bug #872971.
+ # For GCC 10, we changed the slotting from e.g. 10.4 -> 10.
+ local gcc_major_version="${CC_COMP_VERSION%%.*}"
+ if [[ "${gcc_major_version}" -ge 10 ]] ; then
+ echo "CCACHE_COMPILERCHECK=\"string:gcc-${gcc_major_version}\"" >> "${envd}.tmp"
+ fi
+
# Punt old files; maybe globs too much, but oh well
# 'NATIVE' and '.NATIVE' were used by gcc-wrapper before Aug 2018
# and are not used as wrapper is removed.