build: support mach-o ABI

master
osy 2021-01-02 18:34:13 -08:00 committed by Ariadne Conill
parent b6e60b5d64
commit 163c11d989
2 changed files with 16 additions and 4 deletions

View File

@ -51,7 +51,7 @@ FUNC(libucontext_swapcontext)
/* move x1 to x0 and call setcontext */
mov x0, x1
bl libucontext_setcontext
bl PROC_NAME(libucontext_setcontext)
/* hmm, we came back here try to return */
mov x30, x28

View File

@ -18,15 +18,27 @@
#endif
#ifndef TYPE
# define TYPE(__proc) .type __proc, @function;
# ifdef __clang__
# define TYPE(__proc) // .type not supported
# else
# define TYPE(__proc) .type __proc, @function;
#endif
#endif
#ifndef PROC_NAME
# ifdef __MACH__
# define PROC_NAME(__proc) _ ## __proc
# else
# define PROC_NAME(__proc) __proc
# endif
#endif
#define FUNC(__proc) \
.global __proc; \
.global PROC_NAME(__proc); \
.align 2; \
TYPE(__proc) \
ENT(__proc) \
__proc: \
PROC_NAME(__proc): \
SETUP_FRAME(__proc)
#ifdef __clang__
#define END(__proc)