[LLVMdev] ARM __clear_cache fix for compiler-rt when compiling Python

Werner Thie werner at thieprojects.ch
Thu May 23 23:17:35 PDT 2013


Hi all

I received the following patch for compiling ctypes module for Python on 
FreeBSD from Keith White (I'm in no position to judge this fix, I'm just 
passing it on).

Is there anyone on this list being able to commit this code?

Thxs, Werner

===================================================================
--- contrib/compiler-rt/lib/clear_cache.c       (revision 250739)
+++ contrib/compiler-rt/lib/clear_cache.c       (working copy)
@@ -21,6 +21,23 @@
   * specified range.
   */

+/* python ffi routines call it too */
+
+#if defined(__arm__) && defined(__clang__)
+#pragma redefine_extname __clear_cache_c __clear_cache
+void __clear_cache_c(void* start, void* end)
+{
+    extern int sysarch(int number, void *args);
+    struct
+      {
+       unsigned int addr;
+       int          len;
+      } s;
+    s.addr = (unsigned int)(start) & ~0x1f;
+    s.len = (int)((((unsigned int)end + 0x1f) & ~0x1f) - ((unsigned 
int)start & ~0x1f));
+    (void) sysarch (0, &s);
+}
+#else
  void __clear_cache(void* start, void* end)
  {
  #if __i386__ || __x86_64__
@@ -37,4 +54,5 @@
      #endif
  #endif
  }
+#endif



More information about the llvm-dev mailing list