Explicitly #undef ABSL_HASH_INTERNAL_HAS_CRC32 This is to prevent issues like the one explained in [1]. In that case we have been lucky that a test broke on CI, but there are more subtle problems with this approach from Abseil that might lead to the same issue (same string with different hash based on computing the hash on std::string vs std::string_view) or even a SIGILL at runtime since Abseil could run SSE4.2 code while Chromium has SSE3 as a baseline [2]. [1] - https://issues.chromium.org/issues/475029685#comment11 [2] - https://source.chromium.org/chromium/chromium/src/+/main:build/config/win/BUILD.gn;l=119-124;drc=36361cc346d383305d52fca238079611f84fcbef Bug: 475029685 Change-Id: Id2a72dafc334da3500b438a5909eebf561904a17 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7526745 Reviewed-by: Hans Wennborg <hans@chromium.org> Reviewed-by: Danil Chapovalov <danilchap@chromium.org> Commit-Queue: Mirko Bonadei <mbonadei@chromium.org> Cr-Commit-Position: refs/heads/main@{#1575823} NOKEYCHECK=True GitOrigin-RevId: 8fa95c5e785ab7313d08bde17c881d168c21df99
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 37bd39d..5918a0d 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h
@@ -1131,6 +1131,11 @@ return CombineLargeContiguousImplOn32BitLengthGt8(state, first, len); } +// TODO: crbug.com/475029685 - Remove this #undef once Abseil has fixed the +// policy about inline functions with different implementations based on +// target CPU flags since this risks ODR violations (see bug). +#undef ABSL_HASH_INTERNAL_HAS_CRC32 + #ifdef ABSL_HASH_INTERNAL_HAS_CRC32 inline uint64_t CombineContiguousImpl( uint64_t state, const unsigned char* first, size_t len,
diff --git a/patches/0006-undef-absl-hash-internal-has-crc32.patch b/patches/0006-undef-absl-hash-internal-has-crc32.patch new file mode 100644 index 0000000..8919636 --- /dev/null +++ b/patches/0006-undef-absl-hash-internal-has-crc32.patch
@@ -0,0 +1,16 @@ +diff --git a/third_party/abseil-cpp/absl/hash/internal/hash.h b/third_party/abseil-cpp/absl/hash/internal/hash.h +index 37bd39d60a06d..5918a0dfed667 100644 +--- a/third_party/abseil-cpp/absl/hash/internal/hash.h ++++ b/third_party/abseil-cpp/absl/hash/internal/hash.h +@@ -1131,6 +1131,11 @@ inline uint64_t CombineContiguousImpl( + return CombineLargeContiguousImplOn32BitLengthGt8(state, first, len); + } + ++// TODO: crbug.com/475029685 - Remove this #undef once Abseil has fixed the ++// policy about inline functions with different implementations based on ++// target CPU flags since this risks ODR violations (see bug). ++#undef ABSL_HASH_INTERNAL_HAS_CRC32 ++ + #ifdef ABSL_HASH_INTERNAL_HAS_CRC32 + inline uint64_t CombineContiguousImpl( + uint64_t state, const unsigned char* first, size_t len,