[PATCH] D45896: [scudo] Read ARM feature bits using Fuchsia APIs.

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 07:56:33 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT330598: [scudo] Read ARM feature bits using Fuchsia APIs. (authored by cryptoad, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45896?vs=143456&id=143563#toc

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45896

Files:
  lib/scudo/scudo_utils.cpp


Index: lib/scudo/scudo_utils.cpp
===================================================================
--- lib/scudo/scudo_utils.cpp
+++ 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 @@
 }
 
 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; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45896.143563.patch
Type: text/x-patch
Size: 1017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180423/64c51649/attachment.bin>


More information about the llvm-commits mailing list