changeset 410:0aada61f9f8d

ARM EABI bug fixes from Daniel Glockner.
author landley@driftwood
date Mon, 09 Oct 2006 13:12:45 -0400
parents 41f19a7b4093
children aa9f748f021f
files arm-gen.c tcc.c
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/arm-gen.c	Mon Oct 09 13:10:55 2006 -0400
+++ b/arm-gen.c	Mon Oct 09 13:12:45 2006 -0400
@@ -117,6 +117,10 @@
    are directly pushed on stack. */
 //#define FUNC_STRUCT_PARAM_AS_PTR
 
+#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
+static CType float_type, double_type, func_float_type, func_double_type;
+#endif
+
 /* pointer size, in bytes */
 #define PTR_SIZE 4
 
@@ -898,7 +902,7 @@
       o(0xEE000A10); /* fmsr s0,r0 */
     } else {
       o(0xEE000B10); /* fmdlr d0,r0 */
-      o(0xEE200B10); /* fmdhr d0,r1 */
+      o(0xEE201B10); /* fmdhr d0,r1 */
     }
   }
 #endif
@@ -1582,8 +1586,15 @@
     return;
   } else if(bt == VT_LLONG) {
     int func;
+    CType *func_type = &func_old_type;
 #ifdef TCC_ARM_VFP
+#ifdef TCC_ARM_EABI
+    func_type = &func_double_type;
+#endif
     if((t & VT_BTYPE) == VT_FLOAT) {
+#ifdef TCC_ARM_EABI
+      func_type = &func_float_type;
+#endif
       if(vtop->type.t & VT_UNSIGNED)
 	func=TOK___ulltof;
       else
@@ -1594,7 +1605,7 @@
       func=TOK___ulltold;
     else
       func=TOK___slltold;
-    vpush_global_sym(&func_old_type, func);
+    vpush_global_sym(func_type, func);
     vswap();
     gfunc_call(1);
     vpushi(0);
--- a/tcc.c	Mon Oct 09 13:10:55 2006 -0400
+++ b/tcc.c	Mon Oct 09 13:12:45 2006 -0400
@@ -9297,6 +9297,16 @@
     func_old_type.t = VT_FUNC;
     func_old_type.ref = sym_push(SYM_FIELD, &int_type, FUNC_CDECL, FUNC_OLD);
 
+#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
+    float_type.t = VT_FLOAT;
+    double_type.t = VT_DOUBLE;
+
+    func_float_type.t = VT_FUNC;
+    func_float_type.ref = sym_push(SYM_FIELD, &float_type, FUNC_CDECL, FUNC_OLD);
+    func_double_type.t = VT_FUNC;
+    func_double_type.ref = sym_push(SYM_FIELD, &double_type, FUNC_CDECL, FUNC_OLD);
+#endif
+
 #if 0
     /* define 'void *alloca(unsigned int)' builtin function */
     {