winebuild: Fix ARM support.
authorAndré Hentschel <webmaster@dawncrow.de>
Sat, 18 Sep 2010 16:01:16 +0000 (18:01 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 20 Sep 2010 10:55:24 +0000 (12:55 +0200)
tools/winebuild/import.c
tools/winebuild/spec32.c
tools/winebuild/utils.c

index 6a77a3f5eaadddb319a102cc78207b219bb0dc65..1b89352fdc642fc46c8cb9a3440e92e099b42e6d 100644 (file)
@@ -676,8 +676,10 @@ static void output_import_thunk( const char *name, const char *table, int pos )
         output( "\tjmp $31,($0)\n" );
         break;
     case CPU_ARM:
-        output( "\tmov r4, #%s\n", table );
-        output( "\tldr r15, [r4, #%d]\n", pos );
+        output( "\tldr IP,[PC,#0]\n");
+        output( "\tmov PC,PC\n");
+        output( "\t%s %s\n", get_asm_ptr_keyword(), table );
+        output( "\tldr PC,[IP,#%d]\n", pos);
         break;
     case CPU_POWERPC:
         output( "\tmr %s, %s\n", ppc_reg(0), ppc_reg(31) );
@@ -992,9 +994,15 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
         output( "\tjmp $31,($0)\n" );
         break;
     case CPU_ARM:
-        output( "\tstmfd  sp!, {r4, r5, r6, r7, r8, r9, r10, lr}\n" );
-        output( "\tblx %s\n", asm_name("__wine_spec_delay_load") );
-        output( "\tldmfd  sp!, {r4, r5, r6, r7, r8, r9, r10, pc}\n" );
+        output( "\tstmfd  SP!, {r4-r10,FP,LR}\n" );
+        output( "\tmov LR,PC\n");
+        output( "\tadd LR,LR,#8\n");
+        output( "\tldr PC,[PC,#-4]\n");
+        output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name("__wine_spec_delay_load") );
+        output( "\tmov IP,r0\n");
+        output( "\tldmfd  SP!, {r4-r10,FP,LR}\n" );
+        output( "\tldmfd  SP!, {r0-r3}\n" );
+        output( "\tbx IP\n");
         break;
     case CPU_POWERPC:
         if (target_platform == PLATFORM_APPLE) extra_stack_storage = 56;
@@ -1080,7 +1088,17 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
                 output( "\tjmp $31,%s\n", asm_name("__wine_delay_load_asm") );
                 break;
             case CPU_ARM:
-                output( "\tb %s\n", asm_name("__wine_delay_load_asm") );
+                output( "\tstmfd  SP!, {r0-r3}\n" );
+                output( "\tmov r0, #%d\n", idx );
+                output( "\tmov r1, #16384\n" );
+                output( "\tmul r1, r0, r1\n" );
+                output( "\tmov r0, r1\n" );
+                output( "\tmov r1, #4\n" );
+                output( "\tmul r1, r0, r1\n" );
+                output( "\tmov r0, r1\n" );
+                output( "\tadd r0, #%d\n", j );
+                output( "\tldr PC,[PC,#-4]\n");
+                output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name("__wine_delay_load_asm") );
                 break;
             case CPU_POWERPC:
                 switch(target_platform)
index 030a6bc44c6f21d5b314be44acd05b8929b3b66a..29436f1574245096d978841f0f19efa16f4c02c0 100644 (file)
@@ -396,8 +396,6 @@ static void output_asm_constructor( const char *constructor )
             output( "\tjsr $26,%s\n", asm_name(constructor) );
             break;
         case CPU_ARM:
-            output( "\tblx %s\n", asm_name(constructor) );
-            break;
         case CPU_POWERPC:
             output( "\tbl %s\n", asm_name(constructor) );
             break;
index d5902c6eac8229485b24b266d66d3eab4cfff0a0..1dbb6d60d37e76937f38b6d34db7d0836f1ac606 100644 (file)
@@ -840,11 +840,11 @@ unsigned int get_alignment(unsigned int align)
     case CPU_x86:
     case CPU_x86_64:
     case CPU_SPARC:
-    case CPU_ARM:
         if (target_platform != PLATFORM_APPLE) return align;
         /* fall through */
     case CPU_POWERPC:
     case CPU_ALPHA:
+    case CPU_ARM:
         n = 0;
         while ((1u << n) != align) n++;
         return n;