From 50899e30abf3cbd71a09ecc03b2e172f6ba5d4f4 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 9 Mar 2015 00:19:59 +0100 Subject: Fix stack overwrite on structure return The common code to move a returned structure packed into registers into memory on the caller side didn't take the register size into account when allocating local storage, so sometimes that lead to stack overwrites (e.g. in 73_arm64.c), on x86_64. This fixes it by generally making gfunc_sret also return the register size. --- tcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tcc.h') diff --git a/tcc.h b/tcc.h index 7d53b9b..759d3f4 100644 --- a/tcc.h +++ b/tcc.h @@ -1327,7 +1327,7 @@ ST_FUNC void gsym_addr(int t, int a); ST_FUNC void gsym(int t); ST_FUNC void load(int r, SValue *sv); ST_FUNC void store(int r, SValue *v); -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *align); +ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *align, int *regsize); ST_FUNC void gfunc_call(int nb_args); ST_FUNC void gfunc_prolog(CType *func_type); ST_FUNC void gfunc_epilog(void); -- cgit v1.3.1