aboutsummaryrefslogtreecommitdiff
path: root/i386-gen.c
diff options
context:
space:
mode:
authorJames Lyon <jamesly0n@hotmail.com>2013-04-26 00:31:46 +0100
committerJames Lyon <jamesly0n@hotmail.com>2013-04-26 00:31:46 +0100
commitae2ece93da446b53b354b12f2f1dfd0cba6f57b7 (patch)
tree922e88af5d4add6e866621de9b1d0163fda06beb /i386-gen.c
parent1caee8ab3b6c3cf3ceb06d1ec4a5e09e2d90c543 (diff)
downloadtinycc-ae2ece93da446b53b354b12f2f1dfd0cba6f57b7.tar.gz
tinycc-ae2ece93da446b53b354b12f2f1dfd0cba6f57b7.tar.bz2
Fixed i386 calling convention issue and CMake build on i386.
The i386 calling convention expects the callee to pop 1 word of the stack when performing a struct ret.
Diffstat (limited to 'i386-gen.c')
-rw-r--r--i386-gen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/i386-gen.c b/i386-gen.c
index 67123d6..044f9e6 100644
--- a/i386-gen.c
+++ b/i386-gen.c
@@ -464,6 +464,10 @@ ST_FUNC void gfunc_call(int nb_args)
args_size -= 4;
}
}
+#ifndef TCC_TARGET_PE
+ else if ((vtop->type.ref->type.t & VT_BTYPE) == VT_STRUCT)
+ args_size -= 4;
+#endif
gcall_or_jmp(0);
if (args_size && func_call != FUNC_STDCALL)
@@ -549,6 +553,10 @@ ST_FUNC void gfunc_prolog(CType *func_type)
/* pascal type call ? */
if (func_call == FUNC_STDCALL)
func_ret_sub = addr - 8;
+#ifndef TCC_TARGET_PE
+ else if (func_vc)
+ func_ret_sub = 4;
+#endif
#ifdef CONFIG_TCC_BCHECK
/* leave some room for bound checking code */