PR #1794: Update cpu_detect.cc

fix hw crc32 and AES capability check, fix undefined

Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1794

Source and explanation
https://github.com/JuliaLang/julia/issues/26458
https://github.com/memcached/memcached/pull/744

For build for aarch64 on v22_clang-16.0.6-centos7
`
abseil-cpp/absl/crc/internal/cpu_detect.cc:273:20: error: use of undeclared identifier 'HWCAP_CRC32'
  return (hwcaps & HWCAP_CRC32) && (hwcaps & HWCAP_PMULL);
                   ^
abseil-cpp/absl/crc/internal/cpu_detect.cc:273:46: error: use of undeclared identifier 'HWCAP_PMULL'
  return (hwcaps & HWCAP_CRC32) && (hwcaps & HWCAP_PMULL);
`

Merge 3ee325b7a4 into 940e0ec36a

Merging this change closes #1794

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1794 from Dertosh:patch-1 3ee325b7a4
PiperOrigin-RevId: 705936372
Change-Id: Ifebd6d1a854e17acf6cc00bab92053bc0d4c2349
This commit is contained in:
Dertosh
2024-12-13 10:58:56 -08:00
committed by Copybara-Service
parent 940e0ec36a
commit fffac1157d

View File

@@ -269,8 +269,12 @@ CpuType GetCpuType() {
}
bool SupportsArmCRC32PMULL() {
#if defined(HWCAP_CRC32) && defined(HWCAP_PMULL)
uint64_t hwcaps = getauxval(AT_HWCAP);
return (hwcaps & HWCAP_CRC32) && (hwcaps & HWCAP_PMULL);
#else
return false;
#endif
}
#else