Skip to content

Commit

Permalink
fix: avoid macOS linker error for rust_psm_on_stack_end
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cdbennett committed Sep 3, 2024
1 parent 7d6aebe commit e10b08d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
17 changes: 7 additions & 10 deletions psm/src/arch/aarch_aapcs64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
#define GLOBL(fnname) .globl _##fnname
#define TYPE(fnname)
#define FUNCTION(fnname) _##fnname
#define SIZE(fnname,endlabel)
#define END_FUNCTION(fnname)

#elif CFG_TARGET_OS_windows

#define GLOBL(fnname) .globl fnname
#define TYPE(fnname)
#define FUNCTION(fnname) fnname
#define LABEL_FOR_SIZE(endlabel)
#define SIZE(fnname,endlabel)

#else

#define GLOBL(fnname) .globl fnname
#define TYPE(fnname) .type fnname,@function
#define FUNCTION(fnname) fnname
#define SIZE(fnname,endlabel) .size fnname,endlabel-fnname
#define END_FUNCTION(fnname) .size fnname,.-fnname

#endif

Expand All @@ -34,8 +35,7 @@ FUNCTION(rust_psm_stack_direction):
.cfi_startproc
orr w0, wzr, #STACK_DIRECTION_DESCENDING
ret
.rust_psm_stack_direction_end:
SIZE(rust_psm_stack_direction,.rust_psm_stack_direction_end)
END_FUNCTION(rust_psm_stack_direction)
.cfi_endproc


Expand All @@ -47,8 +47,7 @@ FUNCTION(rust_psm_stack_pointer):
.cfi_startproc
mov x0, sp
ret
.rust_psm_stack_pointer_end:
SIZE(rust_psm_stack_pointer,.rust_psm_stack_pointer_end)
END_FUNCTION(rust_psm_stack_pointer)
.cfi_endproc


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


Expand All @@ -87,6 +85,5 @@ FUNCTION(rust_psm_on_stack):
.cfi_restore x29
.cfi_restore x30
ret
.rust_psm_on_stack_end:
SIZE(rust_psm_on_stack,.rust_psm_on_stack_end)
END_FUNCTION(rust_psm_on_stack)
.cfi_endproc
14 changes: 6 additions & 8 deletions psm/src/arch/x86_64.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#define GLOBL(fnname) .globl _##fnname
#define TYPE(fnname)
#define FUNCTION(fnname) _##fnname
#define SIZE(fnname,endlabel)
#define END_FUNCTION(fnname)

#else

#define GLOBL(fnname) .globl fnname
#define TYPE(fnname) .type fnname,@function
#define FUNCTION(fnname) fnname
#define SIZE(fnname,endlabel) .size fnname,endlabel-fnname
#define END_FUNCTION(fnname) .size fnname,.-fnname

#endif

Expand All @@ -28,8 +28,7 @@ FUNCTION(rust_psm_stack_direction):
.cfi_startproc
movb $STACK_DIRECTION_DESCENDING, %al # always descending on x86_64
retq
.rust_psm_stack_direction_end:
SIZE(rust_psm_stack_direction,.rust_psm_stack_direction_end)
END_FUNCTION(rust_psm_stack_direction)
.cfi_endproc


Expand All @@ -42,7 +41,7 @@ FUNCTION(rust_psm_stack_pointer):
leaq 8(%rsp), %rax
retq
.rust_psm_stack_pointer_end:
SIZE(rust_psm_stack_pointer,.rust_psm_stack_pointer_end)
END_FUNCTION(rust_psm_stack_pointer)
.cfi_endproc


Expand All @@ -61,7 +60,7 @@ FUNCTION(rust_psm_replace_stack):
leaq -8(%rdx), %rsp
jmpq *%rsi
.rust_psm_replace_stack_end:
SIZE(rust_psm_replace_stack,.rust_psm_replace_stack_end)
END_FUNCTION(rust_psm_replace_stack)
.cfi_endproc


Expand All @@ -82,6 +81,5 @@ FUNCTION(rust_psm_on_stack):
popq %rbp
.cfi_def_cfa %rsp, 8
retq
.rust_psm_on_stack_end:
SIZE(rust_psm_on_stack,.rust_psm_on_stack_end)
END_FUNCTION(rust_psm_on_stack)
.cfi_endproc

0 comments on commit e10b08d

Please sign in to comment.