summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2020-08-10 15:35:55 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-07 23:01:11 +0000
commit3a3cb2c81939d0acba655890c586351d122673de (patch)
tree32cd5b4b3954fa5b701f3f72e0e1d6bd1651ba4f /site_scons
parent73dd69d37bc64c58a800c8d1225e35d3ca6241cb (diff)
downloadmongo-3a3cb2c81939d0acba655890c586351d122673de.tar.gz
SERVER-50125 Add sanitizer blacklist files to CCACHE_EXTRAFILES
Some versions of ccache do not know how to handle clang's -fsanitizer-blacklist flags. Some versions don't handle it at all, while others only handle one instance, even though it can appear multiple times on the command line. Because the argument can change the resulting compiled object, not taking the flags into account properly can cause ccache to pull an incorrect object file from its cache. The exact behavior depends on the ccache version and how the arguments are changed on the command line. We implement a workaround suggested by the ccache developers until a newer version of ccache with all the required fixes is in common use. * Workaround ref: https://github.com/ccache/ccache/issues/174 (cherry picked from commit 37276b21f4dbd66f913e8d49577fd4b1c4eafbf9)
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/next/ccache.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/site_scons/site_tools/next/ccache.py b/site_scons/site_tools/next/ccache.py
index d96dd848771..2a894919f8d 100644
--- a/site_scons/site_tools/next/ccache.py
+++ b/site_scons/site_tools/next/ccache.py
@@ -138,6 +138,16 @@ def generate(env):
env["ENV"]["CCACHE_CPP2"] = "1"
env.AppendUnique(CCFLAGS=["-fdirectives-only"])
+ # Ensure ccache accounts for any extra files in use that affects the generated object
+ # file. This can be used for situations where a file is passed as an argument to a
+ # compiler parameter and differences in the file need to be accounted for in the
+ # hash result to prevent erroneous cache hits.
+ if "CCACHE_EXTRAFILES" in env and env["CCACHE_EXTRAFILES"]:
+ env["ENV"]["CCACHE_EXTRAFILES"] = ":".join([
+ blackfile.path
+ for blackfile in env["CCACHE_EXTRAFILES"]
+ ])
+
# Make a generator to expand to CCACHE in the case where we are
# not a conftest. We don't want to use ccache for configure tests
# because we don't want to use icecream for configure tests, but