Commit e755ea23 authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Support Windows-style name mangling for fastcall functions.

parent 45d19902
......@@ -374,13 +374,6 @@ static int parse_spec_export( ORDDEF *odp, DLLSPEC *spec )
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;
}
......
......@@ -970,6 +970,9 @@ void output_def_file( DLLSPEC *spec, int include_stubs )
if (!is_private) total++;
if (!include_stubs && odp->type == TYPE_STUB) continue;
if ((odp->flags & FLAG_FASTCALL) && target_platform == PLATFORM_WINDOWS)
name = strmake( "@%s", name );
output( " %s", name );
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 )
{
static char *buffer;
char *ret;
if (!kill_at && target_platform == PLATFORM_WINDOWS && target_cpu == CPU_x86 &&
odp->type == TYPE_STDCALL && !(odp->flags & FLAG_THISCALL))
if (target_cpu != CPU_x86) return odp->link_name;
if (odp->type != TYPE_STDCALL) return odp->link_name;
if (target_platform == PLATFORM_WINDOWS)
{
free( buffer );
buffer = strmake( "%s@%u", odp->link_name, get_args_size( odp ));
return buffer;
if (odp->flags & FLAG_THISCALL) ret = strmake( "__thiscall_%s", odp->link_name );
else if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", odp->link_name, get_args_size( odp ));
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 */
......@@ -1036,6 +1049,7 @@ const char *asm_name( const char *sym )
{
case PLATFORM_WINDOWS:
if (target_cpu != CPU_x86) return sym;
if (sym[0] == '@') return sym; /* fastcall */
/* fall through */
case PLATFORM_APPLE:
if (sym[0] == '.' && sym[1] == 'L') return sym;
......
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