Skip to content

Commit 5d02e2d

Browse files
committed
OSX: fixes to make nlrx64.S with Apple's clang
1 parent e9906ac commit 5d02e2d

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

py/nlrx64.S

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
.text
66

77
/* uint nlr_push(rdi=nlr_buf_t *nlr) */
8+
#ifndef __llvm__
89
.globl nlr_push
910
.type nlr_push, @function
1011
nlr_push:
12+
#else
13+
.globl _nlr_push
14+
_nlr_push:
15+
#endif
1116
movq (%rsp), %rax # load return %rip
1217
movq %rax, 16(%rdi) # store %rip into nlr_buf
1318
movq %rbp, 24(%rdi) # store %rbp into nlr_buf
@@ -22,22 +27,32 @@ nlr_push:
2227
movq %rdi, nlr_top(%rip) # stor new nlr_buf (to make linked list)
2328
xorq %rax, %rax # return 0, normal return
2429
ret # return
25-
.size nlr_push, .-nlr_push
30+
// .size nlr_push, .-nlr_push
2631

2732
/* void nlr_pop() */
33+
#ifndef __llvm__
2834
.globl nlr_pop
2935
.type nlr_pop, @function
3036
nlr_pop:
37+
#else
38+
.globl _nlr_pop
39+
_nlr_pop:
40+
#endif
3141
movq nlr_top(%rip), %rax # get nlr_top into %rax
3242
movq (%rax), %rax # load prev nlr_buf
3343
movq %rax, nlr_top(%rip) # store prev nlr_buf (to unlink list)
3444
ret # return
35-
.size nlr_pop, .-nlr_pop
45+
// .size nlr_pop, .-nlr_pop
3646

3747
/* void nlr_jump(rdi=uint val) */
48+
#ifndef __llvm__
3849
.globl nlr_jump
3950
.type nlr_jump, @function
4051
nlr_jump:
52+
#else
53+
.globl _nlr_jump
54+
_nlr_jump:
55+
#endif
4156
movq %rdi, %rax # put return value in %rax
4257
movq nlr_top(%rip), %rdi # get nlr_top into %rdi
4358
movq %rax, 8(%rdi) # store return value
@@ -55,8 +70,12 @@ nlr_jump:
5570
xorq %rax, %rax # clear return register
5671
inc %al # increase to make 1, non-local return
5772
ret # return
73+
#ifndef __llvm__
5874
.size nlr_jump, .-nlr_jump
75+
#endif
5976

77+
#ifndef __llvm__
6078
.local nlr_top
79+
#endif
6180
.comm nlr_top,8,8
6281
#endif

0 commit comments

Comments
 (0)