]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Add support for Clang -frandomize-layout-seed-file option
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 9 Nov 2024 20:53:07 +0000 (21:53 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 10 Nov 2024 09:50:53 +0000 (10:50 +0100)
Fixes #1528.

src/ccache/ccache.cpp

index b23e731a12f9baba8ce85b8fe10b5d5131f33b17..efc833edd5b036fce48b8b82c4e0b35fabe36c2c 100644 (file)
@@ -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