[llvm-branch-commits] [llvm] [Hashing] Use a non-deterministic seed if LLVM_ENABLE_ABI_BREAKING_CHECKS (PR #96282)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 27 14:44:11 PDT 2024


https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/96282

>From a341e03cb6376d50a4fa219933d3f161e41a567a Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Thu, 27 Jun 2024 14:44:02 -0700
Subject: [PATCH] move seed inside #if

Created using spr 1.3.5-bogner
---
 llvm/include/llvm/ADT/Hashing.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 397109880bb02..177fb0318bf80 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -311,11 +311,11 @@ struct hash_state {
 /// hash values. On platforms without ASLR, this is still likely
 /// non-deterministic per build.
 inline uint64_t get_execution_seed() {
-  [[maybe_unused]] static const char seed = 0;
   // Work around x86-64 negative offset folding for old Clang -fno-pic
   // https://reviews.llvm.org/D93931
 #if LLVM_ENABLE_ABI_BREAKING_CHECKS &&                                         \
     (!defined(__clang__) || __clang_major__ > 11)
+  static const char seed = 0;
   return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(&seed));
 #else
   return 0xff51afd7ed558ccdULL;



More information about the llvm-branch-commits mailing list