Store a relative pointer for registry entry points to avoid some text
relocations.
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index d5ad4e9..d7c4d42 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -675,11 +675,13 @@
args_copy[nb_args] = (int)context; /* append context argument */
if (relay->ret == 0xc3) /* cdecl */
{
- call_cdecl_function( *(LONGLONG_CPROC *)(entry_point + 5), nb_args+1, args_copy );
+ call_cdecl_function( (LONGLONG_CPROC)(entry_point + 5 + *(DWORD *)(entry_point + 5)),
+ nb_args+1, args_copy );
}
else /* stdcall */
{
- call_stdcall_function( *(LONGLONG_FARPROC *)(entry_point + 5), nb_args+1, args_copy );
+ call_stdcall_function( (LONGLONG_FARPROC)(entry_point + 5 + *(DWORD *)(entry_point + 5)),
+ nb_args+1, args_copy );
}
if (TRACE_ON(relay))
diff --git a/include/wine/port.h b/include/wine/port.h
index 9973874..0d9c51a 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -241,7 +241,7 @@
#define DEFINE_REGS_ENTRYPOINT( name, args, pop_args ) \
__ASM_GLOBAL_FUNC( name, \
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
- ".long " __ASM_NAME("__regs_") #name "\n\t" \
+ ".long " __ASM_NAME("__regs_") #name "-.\n\t" \
".byte " #args "," #pop_args )
/* FIXME: add support for other CPUs */
#endif /* __i386__ */
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 0747da4..8772f23 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -1012,7 +1012,8 @@
/* Call the entry point */
- fprintf( outfile, "\tcall *0(%%ebx)\n" );
+ fprintf( outfile, "\taddl (%%ebx),%%ebx\n" );
+ fprintf( outfile, "\tcall *%%ebx\n" );
fprintf( outfile, "\tleal -%d(%%ebp),%%ecx\n", STACK_SPACE );
/* Restore the context structure */