From: Aleksey Demakov Date: Sun, 23 Nov 2008 09:15:24 +0000 (+0000) Subject: Mac OS X compatibility fixes X-Git-Tag: before.move.to.git~52 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=30dabdf9b33bcf17bb5752ec710116ccecf8966a;p=francis%2Flibjit.git Mac OS X compatibility fixes --- diff --git a/ChangeLog b/ChangeLog index 2985e9e..c6a892d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-11-23 Arto Bendiken + + * jit/jit-apply-x86.h, tools/gen-apply.c, tools/gen-apply-macosx.h: + Mac OS X compatibility fixes. + 2008-11-04 Klaus Treichel * jit/jit-apply-x86-64.h (jit_builtin_apply): Use r11 for calling diff --git a/jit/jit-apply-x86.h b/jit/jit-apply-x86.h index 7ee461a..6e224a5 100644 --- a/jit/jit-apply-x86.h +++ b/jit/jit-apply-x86.h @@ -37,6 +37,16 @@ #if !defined(__CYGWIN__) && !defined(__CYGWIN32__) && \ !defined(_WIN32) && !defined(WIN32) +/* Mac OS X prefixes static symbols with an underscore, and external symbol + references are late-bound through a PIC stub by the dynamic linker */ +#ifndef JIT_MEMCPY +# if defined(__APPLE__) && defined(__MACH__) +# define JIT_MEMCPY "L_memcpy$stub" +# else +# define JIT_MEMCPY "memcpy" +# endif +#endif + #define jit_builtin_apply(func,args,size,return_float,return_buf) \ do { \ void *__func = (void *)(func); \ @@ -54,7 +64,7 @@ "pushl %2\n\t" \ "pushl %%ecx\n\t" \ "pushl %%eax\n\t" \ - "call memcpy\n\t" \ + "call " JIT_MEMCPY "\n\t" \ "addl $12, %%esp\n\t" \ "movl %1, %%ecx\n\t" \ "movl %0, %%eax\n\t" \ diff --git a/tools/gen-apply-macosx.h b/tools/gen-apply-macosx.h index 99e6e0e..3acbfab 100644 --- a/tools/gen-apply-macosx.h +++ b/tools/gen-apply-macosx.h @@ -62,6 +62,13 @@ extern "C" { #define JIT_APPLY_X86_POP_STRUCT_RETURN 0 #define JIT_APPLY_PAD_FLOAT_REGS 1 +#define JIT_APPLY_NUM_DOUBLE_REGS 0 +#define JIT_APPLY_NUM_NFLOAT_REGS 0 +#define JIT_APPLY_DOUBLES_IN_WORD_REGS 0 +#define JIT_APPLY_NFLOATS_IN_WORD_REGS 0 +#define JIT_APPLY_RETURN_DOUBLES_AFTER 0 +#define JIT_APPLY_RETURN_NFLOATS_AFTER 0 + #ifdef __cplusplus }; #endif diff --git a/tools/gen-apply.c b/tools/gen-apply.c index b469e98..3117a26 100644 --- a/tools/gen-apply.c +++ b/tools/gen-apply.c @@ -22,7 +22,13 @@ #include #include -#define JIT_MEMCPY "mem_copy" + +#if defined(__APPLE__) && defined(__MACH__) +# define JIT_MEMCPY "_mem_copy" +#else +# define JIT_MEMCPY "mem_copy" +#endif + #include "jit-apply-func.h" #include #include