forked from Mirrors/wine-wine
winebuild: Support Windows-style name mangling for fastcall functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
45d199023f
commit
e755ea2374
|
@ -374,13 +374,6 @@ static int parse_spec_export( ORDDEF *odp, DLLSPEC *spec )
|
||||||
odp->flags |= FLAG_FORWARD;
|
odp->flags |= FLAG_FORWARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((odp->flags & (FLAG_THISCALL | FLAG_FASTCALL)) && !(odp->flags & FLAG_FORWARD))
|
|
||||||
{
|
|
||||||
char *link_name = strmake( "__%s_%s", (odp->flags & FLAG_THISCALL) ? "thiscall" : "fastcall",
|
|
||||||
odp->link_name );
|
|
||||||
free( odp->link_name );
|
|
||||||
odp->link_name = link_name;
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -970,6 +970,9 @@ void output_def_file( DLLSPEC *spec, int include_stubs )
|
||||||
if (!is_private) total++;
|
if (!is_private) total++;
|
||||||
if (!include_stubs && odp->type == TYPE_STUB) continue;
|
if (!include_stubs && odp->type == TYPE_STUB) continue;
|
||||||
|
|
||||||
|
if ((odp->flags & FLAG_FASTCALL) && target_platform == PLATFORM_WINDOWS)
|
||||||
|
name = strmake( "@%s", name );
|
||||||
|
|
||||||
output( " %s", name );
|
output( " %s", name );
|
||||||
|
|
||||||
switch(odp->type)
|
switch(odp->type)
|
||||||
|
|
|
@ -893,15 +893,28 @@ const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec )
|
||||||
const char *get_link_name( const ORDDEF *odp )
|
const char *get_link_name( const ORDDEF *odp )
|
||||||
{
|
{
|
||||||
static char *buffer;
|
static char *buffer;
|
||||||
|
char *ret;
|
||||||
|
|
||||||
if (!kill_at && target_platform == PLATFORM_WINDOWS && target_cpu == CPU_x86 &&
|
if (target_cpu != CPU_x86) return odp->link_name;
|
||||||
odp->type == TYPE_STDCALL && !(odp->flags & FLAG_THISCALL))
|
if (odp->type != TYPE_STDCALL) return odp->link_name;
|
||||||
|
|
||||||
|
if (target_platform == PLATFORM_WINDOWS)
|
||||||
{
|
{
|
||||||
free( buffer );
|
if (odp->flags & FLAG_THISCALL) ret = strmake( "__thiscall_%s", odp->link_name );
|
||||||
buffer = strmake( "%s@%u", odp->link_name, get_args_size( odp ));
|
else if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", odp->link_name, get_args_size( odp ));
|
||||||
return buffer;
|
else if (!kill_at) ret = strmake( "%s@%u", odp->link_name, get_args_size( odp ));
|
||||||
|
else return odp->link_name;
|
||||||
}
|
}
|
||||||
return odp->link_name;
|
else
|
||||||
|
{
|
||||||
|
if (odp->flags & FLAG_THISCALL) ret = strmake( "__thiscall_%s", odp->link_name );
|
||||||
|
else if (odp->flags & FLAG_FASTCALL) ret = strmake( "__fastcall_%s", odp->link_name );
|
||||||
|
else return odp->link_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
free( buffer );
|
||||||
|
buffer = ret;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse a cpu name and return the corresponding value */
|
/* parse a cpu name and return the corresponding value */
|
||||||
|
@ -1036,6 +1049,7 @@ const char *asm_name( const char *sym )
|
||||||
{
|
{
|
||||||
case PLATFORM_WINDOWS:
|
case PLATFORM_WINDOWS:
|
||||||
if (target_cpu != CPU_x86) return sym;
|
if (target_cpu != CPU_x86) return sym;
|
||||||
|
if (sym[0] == '@') return sym; /* fastcall */
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case PLATFORM_APPLE:
|
case PLATFORM_APPLE:
|
||||||
if (sym[0] == '.' && sym[1] == 'L') return sym;
|
if (sym[0] == '.' && sym[1] == 'L') return sym;
|
||||||
|
|
Loading…
Reference in New Issue