Skip to content

Commit

Permalink
PR #1794: Update cpu_detect.cc
Browse files Browse the repository at this point in the history
fix hw crc32 and AES capability check, fix undefined

Imported from GitHub PR #1794

Source and explanation
JuliaLang/julia#26458
memcached/memcached#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 3ee325b into 940e0ec

Merging this change closes #1794

COPYBARA_INTEGRATE_REVIEW=#1794 from Dertosh:patch-1 3ee325b
PiperOrigin-RevId: 705936372
Change-Id: Ifebd6d1a854e17acf6cc00bab92053bc0d4c2349
  • Loading branch information
Dertosh authored and copybara-github committed Dec 13, 2024
1 parent 940e0ec commit fffac11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions absl/crc/internal/cpu_detect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fffac11

Please sign in to comment.