summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/scudo
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2018-04-23 14:53:13 +0000
committerKostya Kortchinsky <kostyak@google.com>2018-04-23 14:53:13 +0000
commit5a8bdc81d6720cbf701a7baebb19d5eeb75a3cea (patch)
treeeba15023375ff9bdb4a15cf36921795f4bc86c40 /compiler-rt/lib/scudo
parent97df22f11052acb6ed47ce14991b7980c3aabd8b (diff)
downloadbcm5719-llvm-5a8bdc81d6720cbf701a7baebb19d5eeb75a3cea.tar.gz
bcm5719-llvm-5a8bdc81d6720cbf701a7baebb19d5eeb75a3cea.zip
[scudo] Read ARM feature bits using Fuchsia APIs.
Summary: Fuchsia uses zx_system_get_features in lieu of getauxval. Use this call when checking for CRC32 support. Reviewers: cryptoad Reviewed By: cryptoad Subscribers: delcypher, llvm-commits, #sanitizers, kristof.beyls, chrib Differential Revision: https://reviews.llvm.org/D45896 llvm-svn: 330598
Diffstat (limited to 'compiler-rt/lib/scudo')
-rw-r--r--compiler-rt/lib/scudo/scudo_utils.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler-rt/lib/scudo/scudo_utils.cpp b/compiler-rt/lib/scudo/scudo_utils.cpp
index 05e63217d96..42c62603309 100644
--- a/compiler-rt/lib/scudo/scudo_utils.cpp
+++ b/compiler-rt/lib/scudo/scudo_utils.cpp
@@ -17,7 +17,10 @@
# include <cpuid.h>
#elif defined(__arm__) || defined(__aarch64__)
# include "sanitizer_common/sanitizer_getauxval.h"
-# if SANITIZER_POSIX
+# if SANITIZER_FUCHSIA
+# include <zircon/syscalls.h>
+# include <zircon/features.h>
+# elif SANITIZER_POSIX
# include "sanitizer_common/sanitizer_posix.h"
# include <fcntl.h>
# endif
@@ -110,9 +113,17 @@ INLINE bool areBionicGlobalsInitialized() {
}
bool hasHardwareCRC32() {
+#if SANITIZER_FUCHSIA
+ u32 HWCap;
+ zx_status_t Status = zx_system_get_features(ZX_FEATURE_KIND_CPU, &HWCap);
+ if (Status != ZX_OK || (HWCap & ZX_ARM64_FEATURE_ISA_CRC32) == 0)
+ return false;
+ return true;
+#else
if (&getauxval && areBionicGlobalsInitialized())
return !!(getauxval(AT_HWCAP) & HWCAP_CRC32);
return hasHardwareCRC32ARMPosix();
+#endif // SANITIZER_FUCHSIA
}
#else
bool hasHardwareCRC32() { return false; }
OpenPOWER on IntegriCloud