Commit 238e1868 authored by Simon Richter's avatar Simon Richter Committed by Alexandre Julliard

winebuild: Fix import stub on ppc.

The address calculation was wrong, as the addition of the lower 16 bits is a signed addition, so if bit 15 is set, the upper 16 bits need to be incremented by one (so the hi portion of the symbol always references the symbol + 0x8000).
parent d1e277fb
...@@ -699,30 +699,20 @@ static void output_import_thunk( const char *name, const char *table, int pos ) ...@@ -699,30 +699,20 @@ static void output_import_thunk( const char *name, const char *table, int pos )
output( "\tjmp $31,($0)\n" ); output( "\tjmp $31,($0)\n" );
break; break;
case CPU_POWERPC: case CPU_POWERPC:
output( "\taddi %s, %s, -0x4\n", ppc_reg(1), ppc_reg(1) ); output( "\tmr %s, %s\n", ppc_reg(0), ppc_reg(31) );
output( "\tstw %s, 0(%s)\n", ppc_reg(9), ppc_reg(1) );
output( "\taddi %s, %s, -0x4\n", ppc_reg(1), ppc_reg(1) );
output( "\tstw %s, 0(%s)\n", ppc_reg(8), ppc_reg(1) );
output( "\taddi %s, %s, -0x4\n", ppc_reg(1), ppc_reg(1) );
output( "\tstw %s, 0(%s)\n", ppc_reg(7), ppc_reg(1) );
if (target_platform == PLATFORM_APPLE) if (target_platform == PLATFORM_APPLE)
{ {
output( "\tlis %s, ha16(%s+%d)\n", ppc_reg(9), table, pos ); output( "\tlis %s, ha16(%s+%d+32768)\n", ppc_reg(31), table, pos );
output( "\tla %s, lo16(%s+%d)(%s)\n", ppc_reg(8), table, pos, ppc_reg(9) ); output( "\tla %s, lo16(%s+%d)(%s)\n", ppc_reg(31), table, pos, ppc_reg(31) );
} }
else else
{ {
output( "\tlis %s, (%s+%d)@h\n", ppc_reg(9), table, pos ); output( "\tlis %s, (%s+%d+32768)@h\n", ppc_reg(31), table, pos );
output( "\tla %s, (%s+%d)@l(%s)\n", ppc_reg(8), table, pos, ppc_reg(9) ); output( "\tla %s, (%s+%d)@l(%s)\n", ppc_reg(31), table, pos, ppc_reg(31) );
} }
output( "\tlwz %s, 0(%s)\n", ppc_reg(7), ppc_reg(8) ); output( "\tlwz %s, 0(%s)\n", ppc_reg(31), ppc_reg(31) );
output( "\tmtctr %s\n", ppc_reg(7) ); output( "\tmtctr %s\n", ppc_reg(31) );
output( "\tlwz %s, 0(%s)\n", ppc_reg(7), ppc_reg(1) ); output( "\tmr %s, %s\n", ppc_reg(31), ppc_reg(0) );
output( "\taddi %s, %s, 0x4\n", ppc_reg(1), ppc_reg(1) );
output( "\tlwz %s, 0(%s)\n", ppc_reg(8), ppc_reg(1) );
output( "\taddi %s, %s, 0x4\n", ppc_reg(1), ppc_reg(1) );
output( "\tlwz %s, 0(%s)\n", ppc_reg(9), ppc_reg(1) );
output( "\taddi %s, %s, 0x4\n", ppc_reg(1), ppc_reg(1) );
output( "\tbctr\n" ); output( "\tbctr\n" );
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment