Fix va_arg fox x86_64
This commit is contained in:
parent
d64923c7b4
commit
0f0f701212
2 changed files with 10 additions and 5 deletions
|
@ -2692,8 +2692,11 @@ struct myspace3 {
|
|||
struct myspace4 {
|
||||
char a[2];
|
||||
};
|
||||
struct mytest {
|
||||
void *foo, *bar, *baz;
|
||||
};
|
||||
|
||||
void stdarg_for_struct(struct myspace bob, ...)
|
||||
struct mytest stdarg_for_struct(struct myspace bob, ...)
|
||||
{
|
||||
struct myspace george, bill;
|
||||
struct myspace2 alex1;
|
||||
|
@ -2713,6 +2716,7 @@ void stdarg_for_struct(struct myspace bob, ...)
|
|||
alex2.a[0], alex3.a[0], alex3.a[1],
|
||||
bob.profile, bill.profile, george.profile, validate);
|
||||
va_end(ap);
|
||||
return (struct mytest) {};
|
||||
}
|
||||
|
||||
void stdarg_for_libc(const char *fmt, ...)
|
||||
|
|
|
@ -1441,7 +1441,7 @@ static void push_arg_reg(int i) {
|
|||
void gfunc_prolog(Sym *func_sym)
|
||||
{
|
||||
CType *func_type = &func_sym->type;
|
||||
X86_64_Mode mode;
|
||||
X86_64_Mode mode, ret_mode;
|
||||
int i, addr, align, size, reg_count;
|
||||
int param_addr = 0, reg_param_index, sse_param_index;
|
||||
Sym *sym;
|
||||
|
@ -1453,10 +1453,12 @@ void gfunc_prolog(Sym *func_sym)
|
|||
ind += FUNC_PROLOG_SIZE;
|
||||
func_sub_sp_offset = ind;
|
||||
func_ret_sub = 0;
|
||||
ret_mode = classify_x86_64_arg(&func_vt, NULL, &size, &align, ®_count);
|
||||
|
||||
if (func_var) {
|
||||
int seen_reg_num, seen_sse_num, seen_stack_size;
|
||||
seen_reg_num = seen_sse_num = 0;
|
||||
seen_reg_num = ret_mode == x86_64_mode_memory;
|
||||
seen_sse_num = 0;
|
||||
/* frame pointer and return address */
|
||||
seen_stack_size = PTR_SIZE * 2;
|
||||
/* count the number of seen parameters */
|
||||
|
@ -1525,8 +1527,7 @@ void gfunc_prolog(Sym *func_sym)
|
|||
|
||||
/* if the function returns a structure, then add an
|
||||
implicit pointer parameter */
|
||||
mode = classify_x86_64_arg(&func_vt, NULL, &size, &align, ®_count);
|
||||
if (mode == x86_64_mode_memory) {
|
||||
if (ret_mode == x86_64_mode_memory) {
|
||||
push_arg_reg(reg_param_index);
|
||||
func_vc = loc;
|
||||
reg_param_index++;
|
||||
|
|
Loading…
Reference in a new issue