libSystem, __clear_cache(), FreeBSD and ARM

Hi folks,

I just tried to build LLVM on FreeBSD/arm. It looks like libSystem
doesn't build and requires the following hack:

--- lib/System/Memory.cpp
+++ lib/System/Memory.cpp
@@ -61,7 +61,7 @@
   for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
     asm volatile("icbi 0, %0" : : "r"(Line));
   asm volatile("isync");
-# elif defined(__arm__) && defined(__GNUC__)
+# elif defined(__arm__) && defined(__GNUC__) && !defined(__FreeBSD__)
   // FIXME: Can we safely always call this for __GNUC__ everywhere?
   char *Start = (char*) Addr;
   char *End = Start + Len;

I don't know anything about ARM, but isn't there a way we can do this
using some inline asm instead of calling a glibc-function?

Greetings,

If you are talking about __clear_cache(), it is defined in libgcc, not
glibc. This should also be available on FreeBSD, though I can only find
the required libgcc2.h header in the gcc source directory...

The function is at least available on FreeBSD/i386-CURRENT:

$ readelf -a /lib/libgcc_s.so.1 | grep __clear_cache
    51: 000046b0 5 FUNC GLOBAL DEFAULT 11 __clear_cache@@GCC_3.0