NaCl runtime fixes
[mono.git] / mono / mini / helpers.c
index 13952b49d0744c5c130da60110986af4380f02db..d945a39b8f2e4e900c08968e3465ee390e17c6bb 100644 (file)
@@ -3,6 +3,9 @@
  *
  * (C) 2003 Ximian, Inc.
  */
+
+#include <config.h>
+
 #include "mini.h"
 #include <ctype.h>
 #include <mono/metadata/opcodes.h>
@@ -11,6 +14,8 @@
 #include <unistd.h>
 #endif
 
+#ifndef DISABLE_JIT
+
 #ifndef DISABLE_LOGGING
 
 #ifdef MINI_OP
@@ -66,6 +71,13 @@ opnames[] = {
 #define emit_debug_info  FALSE
 #endif
 
+/*This enables us to use the right tooling when building the cross compiler for iOS.*/
+#if defined (__APPLE__) && defined (TARGET_ARM) && (defined(__i386__) || defined(__x86_64__))
+
+#define ARCH_PREFIX "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/"
+
+#endif
+
 #define ARCH_PREFIX ""
 //#define ARCH_PREFIX "powerpc64-linux-gnu-"
 
@@ -118,6 +130,9 @@ mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint
 void
 mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
 {
+#if defined(__native_client__)
+       return;
+#endif
 #ifndef DISABLE_LOGGING
        GHashTable *offset_to_bb_hash = NULL;
        int i, cindex, bb_num;
@@ -204,12 +219,24 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
 
 #if defined(sparc)
 #define AS_CMD "as -xarch=v9"
-#elif defined(__i386__) || defined(__x86_64__)
+#elif defined (TARGET_X86)
 #  if defined(__APPLE__)
-#    define AS_CMD "as"
+#    define AS_CMD "as -arch i386"
 #  else
 #    define AS_CMD "as -gstabs"
-#endif
+#  endif
+#elif defined (TARGET_AMD64)
+#  if defined (__APPLE__)
+#    define AS_CMD "as -arch x86_64"
+#  else
+#    define AS_CMD "as -gstabs"
+#  endif
+#elif defined (TARGET_ARM)
+#  if defined (__APPLE__)
+#    define AS_CMD "as -arch arm"
+#  else
+#    define AS_CMD "as -gstabs"
+#  endif
 #elif defined(__mips__) && (_MIPS_SIM == _ABIO32)
 #define AS_CMD "as -mips32"
 #elif defined(__ppc64__)
@@ -258,3 +285,11 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
 #endif
 }
 
+#else /* DISABLE_JIT */
+
+void
+mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom)
+{
+}
+
+#endif /* DISABLE_JIT */