X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fhelpers.c;h=6526e78a445a87fb45bbc89c936b7a1465ad41f2;hb=6d6af6193391f7f8e2f8d9e2ae5635f51e6ead34;hp=29dc782d65f986646248c249b56c1643e94e4355;hpb=8efe5cab3eab18bef5ac682dc66904c4da1f7b9b;p=mono.git diff --git a/mono/mini/helpers.c b/mono/mini/helpers.c index 29dc782d65f..6526e78a445 100644 --- a/mono/mini/helpers.c +++ b/mono/mini/helpers.c @@ -7,41 +7,52 @@ #include #include -#ifndef PLATFORM_WIN32 +#ifndef HOST_WIN32 #include #endif #ifdef MINI_OP #undef MINI_OP #endif +#ifdef MINI_OP3 +#undef MINI_OP3 +#endif #ifdef HAVE_ARRAY_ELEM_INIT #define MSGSTRFIELD(line) MSGSTRFIELD1(line) #define MSGSTRFIELD1(line) str##line static const struct msgstr_t { #define MINI_OP(a,b,dest,src1,src2) char MSGSTRFIELD(__LINE__) [sizeof (b)]; +#define MINI_OP3(a,b,dest,src1,src2,src3) char MSGSTRFIELD(__LINE__) [sizeof (b)]; #include "mini-ops.h" #undef MINI_OP +#undef MINI_OP3 } opstr = { #define MINI_OP(a,b,dest,src1,src2) b, +#define MINI_OP3(a,b,dest,src1,src2,src3) b, #include "mini-ops.h" #undef MINI_OP +#undef MINI_OP3 }; static const gint16 opidx [] = { #define MINI_OP(a,b,dest,src1,src2) [a - OP_LOAD] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#define MINI_OP3(a,b,dest,src1,src2,src3) [a - OP_LOAD] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), #include "mini-ops.h" #undef MINI_OP +#undef MINI_OP3 }; #else #define MINI_OP(a,b,dest,src1,src2) b, +#define MINI_OP3(a,b,dest,src1,src2,src3) b, /* keep in sync with the enum in mini.h */ static const char* const opnames[] = { #include "mini-ops.h" }; #undef MINI_OP +#undef MINI_OP3 #endif @@ -51,6 +62,9 @@ opnames[] = { #define emit_debug_info FALSE #endif +#define ARCH_PREFIX "" +//#define ARCH_PREFIX "powerpc64-linux-gnu-" + const char* mono_inst_name (int op) { if (op >= OP_LOAD && op <= OP_LAST) @@ -100,7 +114,7 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) GHashTable *offset_to_bb_hash = NULL; int i, cindex, bb_num; FILE *ofd; -#ifdef PLATFORM_WIN32 +#ifdef HOST_WIN32 const char *tmp = g_get_tmp_dir (); #endif const char *objdump_args = g_getenv ("MONO_OBJDUMP_ARGS"); @@ -108,7 +122,7 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) char *o_file; char *cmd; -#ifdef PLATFORM_WIN32 +#ifdef HOST_WIN32 as_file = g_strdup_printf ("%s/test.s", tmp); if (!(ofd = fopen (as_file, "w"))) @@ -120,7 +134,9 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) #endif for (i = 0; id [i]; ++i) { - if (!isalnum (id [i])) + if (i == 0 && isdigit (id [i])) + fprintf (ofd, "_"); + else if (!isalnum (id [i])) fprintf (ofd, "_"); else fprintf (ofd, "%c", id [i]); @@ -180,8 +196,12 @@ 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__) -#define AS_CMD "as -gstabs" -#elif defined(__mips__) +# if defined(__APPLE__) +# define AS_CMD "as" +# else +# define AS_CMD "as -gstabs" +#endif +#elif defined(__mips__) && (_MIPS_SIM == _ABIO32) #define AS_CMD "as -mips32" #elif defined(__ppc64__) #define AS_CMD "as -arch ppc64" @@ -191,14 +211,14 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) #define AS_CMD "as" #endif -#ifdef PLATFORM_WIN32 +#ifdef HOST_WIN32 o_file = g_strdup_printf ("%s/test.o", tmp); #else i = g_file_open_tmp (NULL, &o_file, NULL); close (i); #endif - cmd = g_strdup_printf (AS_CMD " %s -o %s", as_file, o_file); + cmd = g_strdup_printf (ARCH_PREFIX AS_CMD " %s -o %s", as_file, o_file); system (cmd); g_free (cmd); if (!objdump_args) @@ -209,16 +229,16 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) * The arm assembler inserts ELF directives instructing objdump to display * everything as data. */ - cmd = g_strdup_printf ("strip -x %s", o_file); + cmd = g_strdup_printf (ARCH_PREFIX "strip -x %s", o_file); system (cmd); g_free (cmd); #endif - cmd = g_strdup_printf (DIS_CMD " %s %s", objdump_args, o_file); + cmd = g_strdup_printf (ARCH_PREFIX DIS_CMD " %s %s", objdump_args, o_file); system (cmd); g_free (cmd); -#ifndef PLATFORM_WIN32 +#ifndef HOST_WIN32 unlink (o_file); unlink (as_file); #endif