Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 52256f5dfc047fb9b499b7b21741ddd01a9a1538..b7543a6398b73475a8014c808a29be967fb7b386 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -329,6 +329,20 @@ config("compiler") { |
} |
} |
+ # We want to force a recompile and relink of the world whenever our toolchain |
+ # changes since artifacts from an older version of the toolchain may or may |
+ # not be compatible with newer ones. To achieve this, we insert a synthetic |
+ # define into the compile line. |
+ if (is_clang && (is_linux || is_mac)) { |
+ if (is_linux) { |
+ toolchain_stamp_file = "//buildtools/linux64/toolchain.stamp" |
+ } else { |
+ toolchain_stamp_file = "//buildtools/mac/toolchain.stamp" |
+ } |
+ toolchain_version = read_file(toolchain_stamp_file, "trim string") |
+ defines = [ "TOOLCHAIN_VERSION=$toolchain_version" ] |
+ } |
+ |
# Assign any flags set for the C compiler to asmflags so that they are sent |
# to the assembler. The Windows assembler takes different types of flags |
# so only do so for posix platforms. |