Skip to content

Commit 3e5b314

Browse files
committed
rt: Implement __morestack for 64-bit mac. Doesn't unwind yet
1 parent 8bf3d85 commit 3e5b314

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/rt/arch/x86_64/morestack.S

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,12 @@
4848
.type MORESTACK,@function
4949
#endif
5050

51-
#if defined(__linux__)
51+
#if defined(__linux__) || defined(__APPLE__)
5252
MORESTACK:
53-
.cfi_startproc
5453

5554
# Set up a normal backtrace
5655
pushq %rbp
57-
.cfi_def_cfa_offset 16
58-
.cfi_offset %rbp, -16
5956
movq %rsp, %rbp
60-
.cfi_def_cfa_register %rbp
6157

6258
// FIXME: libgcc also saves rax. not sure if we need to
6359

@@ -79,9 +75,9 @@ MORESTACK:
7975
pushq %rcx // Address of stack arguments
8076
pushq %r10 // The amount of stack needed
8177

82-
leaq UPCALL_NEW_STACK@PLT(%rip), %rsi
78+
movq UPCALL_NEW_STACK@GOTPCREL(%rip), %rsi
8379
movq %rsp, %rdi
84-
call UPCALL_CALL_C@PLT
80+
call UPCALL_CALL_C@GOTPCREL
8581

8682
// Pop the new_stack_args struct
8783
addq $24, %rsp
@@ -106,15 +102,14 @@ MORESTACK:
106102
// Align the stack again
107103
pushq $0
108104

109-
leaq UPCALL_DEL_STACK@PLT(%rip), %rsi
105+
movq UPCALL_DEL_STACK@GOTPCREL(%rip), %rsi
110106
movq $0, %rdi
111-
call UPCALL_CALL_C@PLT
107+
call UPCALL_CALL_C@GOTPCREL
112108

113109
addq $8, %rsp
114110
popq %rbp
115111
ret
116112

117-
.cfi_endproc
118113
#else
119114
MORESTACK:
120115
ret

0 commit comments

Comments
 (0)