From 18aeedc6b24aa7be7c5bd701e372ab2727d8aa7e Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 9 Nov 2024 21:53:07 +0100 Subject: [PATCH] fix: Add support for Clang -frandomize-layout-seed-file option Fixes #1528. --- src/ccache/ccache.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ccache/ccache.cpp b/src/ccache/ccache.cpp index b23e731a..efc833ed 100644 --- a/src/ccache/ccache.cpp +++ b/src/ccache/ccache.cpp @@ -1823,6 +1823,18 @@ hash_argument(const Context& ctx, return {}; } + static const std::string_view frandomize_layout_seed_file = + "-frandomize-layout-seed-file="; + if (util::starts_with(args[i], frandomize_layout_seed_file)) { + hash.hash_delimiter(frandomize_layout_seed_file); + auto file = args[i].substr(frandomize_layout_seed_file.length()); + if (!hash_binary_file(ctx, hash, file)) { + LOG("Failed to hash {}", file); + return tl::unexpected(Statistic::bad_input_file); + } + return {}; + } + // When using the preprocessor, some arguments don't contribute to the hash. // The theory is that these arguments will change the output of -E if they are // going to have any effect at all. For precompiled headers this might not be -- 2.47.3