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 8bc7708
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion psm/src/arch/aarch_aapcs64.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@
#define GLOBL(fnname) .globl _##fnname
#define TYPE(fnname)
#define FUNCTION(fnname) _##fnname
#define LABEL_FOR_SIZE(endlabel)
#define SIZE(fnname,endlabel)

#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 LABEL_FOR_SIZE(endlabel) endlabel:
#define SIZE(fnname,endlabel) .size fnname,endlabel-fnname

#endif
Expand Down Expand Up @@ -87,6 +90,6 @@ FUNCTION(rust_psm_on_stack):
.cfi_restore x29
.cfi_restore x30
ret
.rust_psm_on_stack_end:
LABEL_FOR_SIZE(rust_psm_on_stack_end)
SIZE(rust_psm_on_stack,.rust_psm_on_stack_end)
.cfi_endproc
4 changes: 3 additions & 1 deletion psm/src/arch/x86_64.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
#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 LABEL_FOR_SIZE(endlabel) endlabel:
#define SIZE(fnname,endlabel) .size fnname,endlabel-fnname

#endif
Expand Down Expand Up @@ -82,6 +84,6 @@ FUNCTION(rust_psm_on_stack):
popq %rbp
.cfi_def_cfa %rsp, 8
retq
.rust_psm_on_stack_end:
LABEL_FOR_SIZE(rust_psm_on_stack_end)
SIZE(rust_psm_on_stack,.rust_psm_on_stack_end)
.cfi_endproc

0 comments on commit 8bc7708

Please sign in to comment.