Skip to content

Commit f7f1e58

Browse files
cdbennettnagisa
authored andcommitted
fix: avoid macOS linker error for rust_psm_on_stack_end
On macOS targets, don't define the symbol `rust_psm_on_stack_end` since it isn't used (and somehow this causes the build to fail). Fixes #87
1 parent 7d6aebe commit f7f1e58

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

psm/src/arch/aarch_aapcs64.s

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77
#define GLOBL(fnname) .globl _##fnname
88
#define TYPE(fnname)
99
#define FUNCTION(fnname) _##fnname
10-
#define SIZE(fnname,endlabel)
10+
#define END_FUNCTION(fnname)
1111

1212
#elif CFG_TARGET_OS_windows
1313

1414
#define GLOBL(fnname) .globl fnname
1515
#define TYPE(fnname)
1616
#define FUNCTION(fnname) fnname
17+
#define LABEL_FOR_SIZE(endlabel)
1718
#define SIZE(fnname,endlabel)
1819

1920
#else
2021

2122
#define GLOBL(fnname) .globl fnname
2223
#define TYPE(fnname) .type fnname,@function
2324
#define FUNCTION(fnname) fnname
24-
#define SIZE(fnname,endlabel) .size fnname,endlabel-fnname
25+
#define END_FUNCTION(fnname) .size fnname,.-fnname
2526

2627
#endif
2728

@@ -34,8 +35,7 @@ FUNCTION(rust_psm_stack_direction):
3435
.cfi_startproc
3536
orr w0, wzr, #STACK_DIRECTION_DESCENDING
3637
ret
37-
.rust_psm_stack_direction_end:
38-
SIZE(rust_psm_stack_direction,.rust_psm_stack_direction_end)
38+
END_FUNCTION(rust_psm_stack_direction)
3939
.cfi_endproc
4040

4141

@@ -47,8 +47,7 @@ FUNCTION(rust_psm_stack_pointer):
4747
.cfi_startproc
4848
mov x0, sp
4949
ret
50-
.rust_psm_stack_pointer_end:
51-
SIZE(rust_psm_stack_pointer,.rust_psm_stack_pointer_end)
50+
END_FUNCTION(rust_psm_stack_pointer)
5251
.cfi_endproc
5352

5453

@@ -61,8 +60,7 @@ FUNCTION(rust_psm_replace_stack):
6160
/* All we gotta do is set the stack pointer to %rdx & tail-call the callback in %rsi */
6261
mov sp, x2
6362
br x1
64-
.rust_psm_replace_stack_end:
65-
SIZE(rust_psm_replace_stack,.rust_psm_replace_stack_end)
63+
END_FUNCTION(rust_psm_replace_stack)
6664
.cfi_endproc
6765

6866

@@ -87,6 +85,5 @@ FUNCTION(rust_psm_on_stack):
8785
.cfi_restore x29
8886
.cfi_restore x30
8987
ret
90-
.rust_psm_on_stack_end:
91-
SIZE(rust_psm_on_stack,.rust_psm_on_stack_end)
88+
END_FUNCTION(rust_psm_on_stack)
9289
.cfi_endproc

psm/src/arch/x86_64.s

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
#define GLOBL(fnname) .globl _##fnname
99
#define TYPE(fnname)
1010
#define FUNCTION(fnname) _##fnname
11-
#define SIZE(fnname,endlabel)
11+
#define END_FUNCTION(fnname)
1212

1313
#else
1414

1515
#define GLOBL(fnname) .globl fnname
1616
#define TYPE(fnname) .type fnname,@function
1717
#define FUNCTION(fnname) fnname
18-
#define SIZE(fnname,endlabel) .size fnname,endlabel-fnname
18+
#define END_FUNCTION(fnname) .size fnname,.-fnname
1919

2020
#endif
2121

@@ -28,8 +28,7 @@ FUNCTION(rust_psm_stack_direction):
2828
.cfi_startproc
2929
movb $STACK_DIRECTION_DESCENDING, %al # always descending on x86_64
3030
retq
31-
.rust_psm_stack_direction_end:
32-
SIZE(rust_psm_stack_direction,.rust_psm_stack_direction_end)
31+
END_FUNCTION(rust_psm_stack_direction)
3332
.cfi_endproc
3433

3534

@@ -42,7 +41,7 @@ FUNCTION(rust_psm_stack_pointer):
4241
leaq 8(%rsp), %rax
4342
retq
4443
.rust_psm_stack_pointer_end:
45-
SIZE(rust_psm_stack_pointer,.rust_psm_stack_pointer_end)
44+
END_FUNCTION(rust_psm_stack_pointer)
4645
.cfi_endproc
4746

4847

@@ -61,7 +60,7 @@ FUNCTION(rust_psm_replace_stack):
6160
leaq -8(%rdx), %rsp
6261
jmpq *%rsi
6362
.rust_psm_replace_stack_end:
64-
SIZE(rust_psm_replace_stack,.rust_psm_replace_stack_end)
63+
END_FUNCTION(rust_psm_replace_stack)
6564
.cfi_endproc
6665

6766

@@ -82,6 +81,5 @@ FUNCTION(rust_psm_on_stack):
8281
popq %rbp
8382
.cfi_def_cfa %rsp, 8
8483
retq
85-
.rust_psm_on_stack_end:
86-
SIZE(rust_psm_on_stack,.rust_psm_on_stack_end)
84+
END_FUNCTION(rust_psm_on_stack)
8785
.cfi_endproc

0 commit comments

Comments
 (0)