macos: ldd does not exit, use otool instead
[tinycc.git] / lib / alloca86_64-bt.S
blobd1df3a94108618178260dbba8929ef7b60297ae9
1 /* ---------------------------------------------- */
2 /* alloca86_64.S */
4 #ifdef __leading_underscore
5 # define _(s) _##s
6 #else
7 # define _(s) s
8 #endif
10 .globl _(__bound_alloca)
11 _(__bound_alloca):
12 #ifdef _WIN32
13     inc %rcx            # add one extra to separate regions
14     jmp _(alloca)
15 .globl _(__bound_alloca_nr)
16 _(__bound_alloca_nr):
17     dec     %rcx
18     push    %rax
19     mov     %rcx,%rdx
20     mov     %rax,%rcx
21     sub     $32,%rsp
22     call    _(__bound_new_region)
23     add     $32,%rsp
24     pop     %rax
25     ret
26 #else
27     pop     %rdx
28     mov     %rdi,%rax
29     mov     %rax,%rsi   # size, a second parm to the __bound_new_region
31     add     $15 + 1,%rax  # add one extra to separate regions
32     and     $-16,%rax
33     jz      p3
36     sub     %rax,%rsp
37     mov     %rsp,%rdi   # pointer, a first parm to the __bound_new_region
38     mov     %rsp,%rax
40     push    %rdx
41     push    %rax
42     call    _(__bound_new_region)
43     pop     %rax
44     pop     %rdx
46 p3:
47     push    %rdx
48     ret
49 #endif
51 /* ---------------------------------------------- */