mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-13 05:10:07 +08:00
x86-64: Fix stdarg for large non-float structs
Some structs are passed in registers. When they need more than one the implementation of __va_arg on x86-64 didn't correctly account for this. This fixes only the cases where the structs consist of integer types, as there the register save area is consecutive. Fixes some tests from 73_arm64.c, but still leaves those failing that use floating point in the large-but-regpassed structs.
This commit is contained in:
parent
2eb4f4a3ba
commit
25b2779c3d
@ -688,11 +688,10 @@ void *__va_arg(__va_list_struct *ap,
|
|||||||
align = (align + 7) & ~7;
|
align = (align + 7) & ~7;
|
||||||
switch (arg_type) {
|
switch (arg_type) {
|
||||||
case __va_gen_reg:
|
case __va_gen_reg:
|
||||||
if (ap->gp_offset < 48) {
|
if (ap->gp_offset + size <= 48) {
|
||||||
ap->gp_offset += 8;
|
ap->gp_offset += size;
|
||||||
return ap->reg_save_area + ap->gp_offset - 8;
|
return ap->reg_save_area + ap->gp_offset - size;
|
||||||
}
|
}
|
||||||
size = 8;
|
|
||||||
goto use_overflow_area;
|
goto use_overflow_area;
|
||||||
|
|
||||||
case __va_float_reg:
|
case __va_float_reg:
|
||||||
|
Loading…
Reference in New Issue
Block a user