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-09-03 19:55:42 +0000
commit37276b21f4dbd66f913e8d49577fd4b1c4eafbf9 (patch)
tree354027d9174b7a4bce60b4ff12c505a9bf26cd08 /site_scons
parentecc06d297844ec06d206d68e0759e2078cd272d2 (diff)
downloadmongo-37276b21f4dbd66f913e8d49577fd4b1c4eafbf9.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
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