[pcre-dev] [Bug 1774] New: Can't build JIT for Android ARM64

Top Page
Delete this message
Author: admin
Date:  
To: pcre-dev
New-Topics: [pcre-dev] [Bug 1774] Can't build JIT for Android ARM64, [pcre-dev] [Bug 1774] Can't build JIT for Android ARM64, [pcre-dev] [Bug 1774] Can't build JIT for Android ARM64, [pcre-dev] [Bug 1774] Can't build JIT for Android ARM64
Subject: [pcre-dev] [Bug 1774] New: Can't build JIT for Android ARM64
https://bugs.exim.org/show_bug.cgi?id=1774

            Bug ID: 1774
           Summary: Can't build JIT for Android ARM64
           Product: PCRE
           Version: 10.20 (PCRE2)
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: tavianator@???
                CC: pcre-dev@???


Android doesn't define cacheflush on all architectures, such as ARM64.
unistd.h has this comment:

#if defined(__arm__) || (defined(__mips__) && !defined(__LP64__))
extern int cacheflush(long, long, long);
    /* __attribute__((deprecated("use __builtin___clear_cache instead"))); */
#endif


So, we might as well use it:

diff --git a/src/sljit/sljitConfigInternal.h b/src/sljit/sljitConfigInternal.h
index 8a4b966..e0f88fd 100644
--- a/src/sljit/sljitConfigInternal.h
+++ b/src/sljit/sljitConfigInternal.h
@@ -262,6 +262,14 @@
#define SLJIT_UNUSED_ARG(arg) (void)arg
#endif

+#ifndef SLJIT_HAS_BUILTIN
+#ifdef __has_builtin
+#define SLJIT_HAS_BUILTIN(x) __has_builtin(x)
+#else
+#define SLJIT_HAS_BUILTIN(x) 0
+#endif
+#endif
+
/*********************************/
/* Type of public API functions. */
/*********************************/
@@ -286,7 +294,14 @@

#ifndef SLJIT_CACHE_FLUSH

-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (__GNUC__ > 4 \
+     || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+     || SLJIT_HAS_BUILTIN(__builtin___clear_cache))
+
+#define SLJIT_CACHE_FLUSH(from, to) \
+        __builtin___clear_cache((char*)from, (char*)to)
+
+#elif (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)


/* Not required to implement on archs with unified caches. */
#define SLJIT_CACHE_FLUSH(from, to)

--
You are receiving this mail because:
You are on the CC list for the bug.