mirror of
https://github.com/frida/tinycc
synced 2024-12-24 22:16:49 +03:00
win32: structure return GCC compatible (ret 4 with cdecl)
This commit is contained in:
parent
ec54c34b9e
commit
610fd47510
11
i386-gen.c
11
i386-gen.c
@ -402,6 +402,11 @@ void gfunc_call(int nb_args)
|
||||
}
|
||||
}
|
||||
gcall_or_jmp(0);
|
||||
|
||||
#ifdef TCC_TARGET_PE
|
||||
if ((func_sym->type.t & VT_BTYPE) == VT_STRUCT)
|
||||
args_size -= 4;
|
||||
#endif
|
||||
if (args_size && func_call != FUNC_STDCALL)
|
||||
gadd_sp(args_size);
|
||||
vtop--;
|
||||
@ -426,6 +431,8 @@ void gfunc_prolog(CType *func_type)
|
||||
func_call = FUNC_CALL(sym->r);
|
||||
addr = 8;
|
||||
loc = 0;
|
||||
func_vc = 0;
|
||||
|
||||
if (func_call >= FUNC_FASTCALL1 && func_call <= FUNC_FASTCALL3) {
|
||||
fastcall_nb_regs = func_call - FUNC_FASTCALL1 + 1;
|
||||
fastcall_regs_ptr = fastcall_regs;
|
||||
@ -478,6 +485,10 @@ void gfunc_prolog(CType *func_type)
|
||||
/* pascal type call ? */
|
||||
if (func_call == FUNC_STDCALL)
|
||||
func_ret_sub = addr - 8;
|
||||
#ifdef TCC_TARGET_PE
|
||||
else if (func_vc)
|
||||
func_ret_sub = 4;
|
||||
#endif
|
||||
|
||||
/* leave some room for bound checking code */
|
||||
if (tcc_state->do_bounds_check) {
|
||||
|
Loading…
Reference in New Issue
Block a user