History

Fix alloca on x86_64 windows

herman ten brugge committed 6 years ago

Commit 426d32a1 parent a0bc1492 files · +12 −3Browse files

Unified · Split

2 files
  1. lib/alloca86_64-bt.S +11 −2
  2. x86_64-gen.c +1 −1
lib/alloca86_64-bt.S+11−2
@@ -5,7 +5,6 @@ · 4 unmodified lines
5__bound_alloca:5__bound_alloca:
6 6
7#ifdef _WIN327#ifdef _WIN32
8 # bound checking is not implemented
9 pop %rdx8 pop %rdx
10 mov %rcx,%rax9 mov %rcx,%rax
11 add $15,%rax10 add $15,%rax
@@ -23,8 +22,18 @@ p2: · 11 unmodified lines
23 22
24 sub %rax,%rsp23 sub %rax,%rsp
25 mov %rsp,%rax24 mov %rsp,%rax
26 add $32,%rax
27 25
26 push %rdx
27 push %rax
28 mov %rcx,%rdx
29 mov %rax,%rcx
30 sub $20,%rsp
31 call __bound_new_region
32 add $20,%rsp
33 pop %rax
34 pop %rdx
35
36 add $32,%rax
28p3:37p3:
29 push %rdx38 push %rdx
30 ret39 ret
x86_64-gen.c+1−1
@@ -1025,7 +1025,7 @@ void gfunc_call(int nb_args) · 1024 unmodified lines
1025 1025
1026 if ((vtop->r & VT_SYM) && vtop->sym->v == TOK_alloca) {1026 if ((vtop->r & VT_SYM) && vtop->sym->v == TOK_alloca) {
1027 /* need to add the "func_scratch" area after alloca */1027 /* need to add the "func_scratch" area after alloca */
1028 o(0x48); func_alloca = oad(0x05, func_alloca); /* sub $NN, %rax */1028 o(0x48); func_alloca = oad(0x2d, func_alloca); /* sub $NN, %rax */
1029 }1029 }
1030 1030
1031 /* other compilers don't clear the upper bits when returning char/short */1031 /* other compilers don't clear the upper bits when returning char/short */

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