scudo: Fix compilation for non-Linux aarch64
authorRoland McGrath <mcgrathr@google.com>
Tue, 5 Jan 2021 19:55:11 +0000 (11:55 -0800)
committerRoland McGrath <mcgrathr@google.com>
Tue, 5 Jan 2021 21:21:52 +0000 (13:21 -0800)
Linux-specific aarch64 code was deconditionalized in commit
dfa40840e0e2fa094c5d3f441affe0785cdc8d09.  This broke builds for
non-Linux aarch64 platforms.

Reviewed By: cryptoad

Differential Revision: https://reviews.llvm.org/D94108

compiler-rt/lib/scudo/standalone/memtag.h

index d848e3a..b1b6206 100644 (file)
@@ -52,6 +52,8 @@ inline uint8_t extractTag(uptr Ptr) {
 
 #if defined(__aarch64__)
 
+#if SCUDO_LINUX
+
 inline bool systemSupportsMemoryTagging() {
 #ifndef HWCAP2_MTE
 #define HWCAP2_MTE (1 << 18)
@@ -77,6 +79,14 @@ inline bool systemDetectsMemoryTagFaultsTestOnly() {
           PR_MTE_TCF_MASK) != PR_MTE_TCF_NONE;
 }
 
+#else // !SCUDO_LINUX
+
+inline bool systemSupportsMemoryTagging() { return false; }
+
+inline bool systemDetectsMemoryTagFaultsTestOnly() { return false; }
+
+#endif // SCUDO_LINUX
+
 inline void disableMemoryTagChecksTestOnly() {
   __asm__ __volatile__(".arch_extension mte; msr tco, #1");
 }