For example, changing from hardened to vanilla specs while using the same main version. Although ccache checks for options "--specs", it doesn't check GCC_SPECS, our Gentoo-specific patch to support compiler specs switching. Patch to follow to add specs files listed in GCC_SPECS.
Created attachment 78744 [details, diff] Adds contents of specs files listed in GCC_SPECS to the hash.
hmm; occurs to me this isn't good enough, as we set GCC_SPECS in the gcc wrapper, in which case ccache won't see it. I think to be complete, we'd need to some or all of: 1) output of 'gcc -v' 2) output of 'gcc -dumpspecs' 3) contents of spec files listed by 'gcc -v' in practice it might be enough just (1).
Created attachment 78754 [details, diff] add output of '<compiler> -v' to the hash Ok; this is a simple enough patch to add the output of '<compiler> -v' to the hash. I think this is enough to capture changes in compiler driven by our specs trickery. It doesn't actually hash the specs themselves, but I don't think that's necessary.
You should submit the patch upstream to the ccache mail list, http://lists.samba.org/mailman/listinfo/ccache/
This should have been closed UPSTREAM as it is an upstream improvement request.
Well, as I said before, the problem is caused by the GCC_SPECS patch we apply to our compilers to support switching specs in the environment. Without that patch there's no need to hash the output of 'gcc -v'. This means that as far as upstream are concerned, it's not relevant - unless they maintain distribution-specific variations (which I think they don't). Also I'm not sure they would be keen on adding a separate invocation of the compiler driver to every ccache call. Perhaps "WONTFIX" might be a better resolution.