winebuild: Split get_link_name into a separate get_abi_name helper.

This commit is contained in:
Rémi Bernon 2022-10-02 23:32:57 +02:00 committed by Alexandre Julliard
parent c3769732f8
commit 6932138f17

View file

@ -728,28 +728,28 @@ const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec )
}
/* return the stdcall-decorated name for an entry point */
const char *get_link_name( const ORDDEF *odp )
static const char *get_abi_name( const ORDDEF *odp, const char *name )
{
static char *buffer;
char *ret;
if (target.cpu != CPU_i386) return odp->link_name;
if (target.cpu != CPU_i386) return name;
switch (odp->type)
{
case TYPE_STDCALL:
if (is_pe())
{
if (odp->flags & FLAG_THISCALL) return odp->link_name;
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;
if (odp->flags & FLAG_THISCALL) return name;
if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", name, get_args_size( odp ));
else if (!kill_at) ret = strmake( "%s@%u", name, get_args_size( odp ));
else return 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;
if (odp->flags & FLAG_THISCALL) ret = strmake( "__thiscall_%s", name );
else if (odp->flags & FLAG_FASTCALL) ret = strmake( "__fastcall_%s", name );
else return name;
}
break;
@ -758,13 +758,13 @@ const char *get_link_name( const ORDDEF *odp )
{
int args = get_args_size( odp );
if (odp->flags & FLAG_REGISTER) args += get_ptr_size(); /* context argument */
ret = strmake( "%s@%u", odp->link_name, args );
ret = strmake( "%s@%u", name, args );
}
else return odp->link_name;
else return name;
break;
default:
return odp->link_name;
return name;
}
free( buffer );
@ -772,6 +772,11 @@ const char *get_link_name( const ORDDEF *odp )
return ret;
}
const char *get_link_name( const ORDDEF *odp )
{
return get_abi_name( odp, odp->link_name );
}
/*******************************************************************
* sort_func_list
*