History

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.

Michael Matz committed 11 years ago

Commit 25b27791 parent 2eb4f4a1 file · +3 −4Browse files

Unified · Split

lib/libtcc1.c+3−4
@@ -688,11 +688,10 @@ void *__va_arg(__va_list_struct *ap, · 687 unmodified lines
688688 align = (align + 7) & ~7;
689689 switch (arg_type) {
690690 case __va_gen_reg:
691− if (ap->gp_offset < 48) {
692− ap->gp_offset += 8;
693− return ap->reg_save_area + ap->gp_offset - 8;
691+ if (ap->gp_offset + size <= 48) {
692+ ap->gp_offset += size;
693+ return ap->reg_save_area + ap->gp_offset - size;
694694 }
695− size = 8;
696695 goto use_overflow_area;
697696
698697 case __va_float_reg:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t