1
0
Fork 0

Fix alloca on x86_64 windows

This commit is contained in:
herman ten brugge 2019-12-11 14:06:15 +01:00
parent a0bc149b0c
commit 426d32af23
2 changed files with 12 additions and 3 deletions

View File

@ -5,7 +5,6 @@
__bound_alloca:
#ifdef _WIN32
# bound checking is not implemented
pop %rdx
mov %rcx,%rax
add $15,%rax
@ -23,8 +22,18 @@ p2:
sub %rax,%rsp
mov %rsp,%rax
add $32,%rax
push %rdx
push %rax
mov %rcx,%rdx
mov %rax,%rcx
sub $20,%rsp
call __bound_new_region
add $20,%rsp
pop %rax
pop %rdx
add $32,%rax
p3:
push %rdx
ret

View File

@ -1025,7 +1025,7 @@ void gfunc_call(int nb_args)
if ((vtop->r & VT_SYM) && vtop->sym->v == TOK_alloca) {
/* need to add the "func_scratch" area after alloca */
o(0x48); func_alloca = oad(0x05, func_alloca); /* sub $NN, %rax */
o(0x48); func_alloca = oad(0x2d, func_alloca); /* sub $NN, %rax */
}
/* other compilers don't clear the upper bits when returning char/short */