aboutsummaryrefslogtreecommitdiff
path: root/i386-gen.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-06-17 02:11:13 +0200
committergrischka <grischka>2009-06-17 02:11:13 +0200
commit610fd4751023f573d9baa3357eab6259b18a3f6a (patch)
tree641b19a844bcd15b4925ef46cf398f40e33dcda9 /i386-gen.c
parentec54c34b9ef7f5102b07b708bf0662fb4428529f (diff)
downloadtinycc-610fd4751023f573d9baa3357eab6259b18a3f6a.tar.gz
tinycc-610fd4751023f573d9baa3357eab6259b18a3f6a.tar.bz2
win32: structure return GCC compatible (ret 4 with cdecl)
Diffstat (limited to 'i386-gen.c')
-rw-r--r--i386-gen.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/i386-gen.c b/i386-gen.c
index f958ab5..2edbe2f 100644
--- a/i386-gen.c
+++ b/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) {