Module: wine Branch: master Commit: bbfc0d1d64d0c4477bb7b5f5893785277de90290 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bbfc0d1d64d0c4477bb7b5f589...
Author: André Hentschel webmaster@dawncrow.de Date: Sat Sep 18 18:01:16 2010 +0200
winebuild: Fix ARM support.
---
tools/winebuild/import.c | 30 ++++++++++++++++++++++++------ tools/winebuild/spec32.c | 2 -- tools/winebuild/utils.c | 2 +- 3 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 6a77a3f..1b89352 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -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) diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 030a6bc..29436f1 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -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; diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index d5902c6..1dbb6d6 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -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;