mirror of
https://github.com/frida/tinycc
synced 2024-11-27 18:19:35 +03:00
Fix stored type of arguments on x86-64
the lvalue Syms for arguments didn't correctly reflect their own types in all cases (a side-effect of the type being stored in type->t and the ->r members (as VT_LVAL_xxx), so the below used an int load (not a byte load) in the conditional. extern void bar (void); void foo (signed char c) { signed char x = c; if (c) bar(); }
This commit is contained in:
parent
91bdb5a4a3
commit
65c7f19deb
@ -988,7 +988,8 @@ void gfunc_prolog(CType *func_type)
|
||||
if (reg_param_index < REGN) {
|
||||
gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);
|
||||
}
|
||||
sym_push(sym->v & ~SYM_FIELD, type, VT_LLOCAL | VT_LVAL, addr);
|
||||
sym_push(sym->v & ~SYM_FIELD, type,
|
||||
VT_LLOCAL | lvalue_type(type->t), addr);
|
||||
} else {
|
||||
if (reg_param_index < REGN) {
|
||||
/* save arguments passed by register */
|
||||
@ -1001,7 +1002,8 @@ void gfunc_prolog(CType *func_type)
|
||||
gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);
|
||||
}
|
||||
}
|
||||
sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL, addr);
|
||||
sym_push(sym->v & ~SYM_FIELD, type,
|
||||
VT_LOCAL | lvalue_type(type->t), addr);
|
||||
}
|
||||
addr += 8;
|
||||
reg_param_index++;
|
||||
@ -1567,7 +1569,7 @@ void gfunc_prolog(CType *func_type)
|
||||
default: break; /* nothing to be done for x86_64_mode_none */
|
||||
}
|
||||
sym_push(sym->v & ~SYM_FIELD, type,
|
||||
VT_LOCAL | VT_LVAL, param_addr);
|
||||
VT_LOCAL | lvalue_type(type->t), param_addr);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TCC_BCHECK
|
||||
|
Loading…
Reference in New Issue
Block a user