From 8f17af703bbc75155cdfd0c06c11c898cf309c1e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 23 Mar 2021 23:28:47 -0700 Subject: build: port to Apple M1. * configure (lit_align): Also don't calculate lit_align as 2 on Darwin/arm64; that is a hack needed on 32 bit x86 Mac OS. * jmp.S: Define DEFUN for Arm64 on Darwin. We have to use %% as the statement separator; semicolons are comments. Use the same __aarch64__ code for __arm64__. We just need some Apple specific tidbits before and after. --- configure | 2 +- jmp.S | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure b/configure index de63be92..4739ccd4 100755 --- a/configure +++ b/configure @@ -1496,7 +1496,7 @@ if [ -z "$lit_align" ] ; then exit 1 fi - if [ -n "$darwin_target" ] ; then + if [ -n "$darwin_target" ] && [ "$(arch)" = "i386" ] ; then lit_align=2 else lit_align=$SIZEOF_WCHAR_T diff --git a/jmp.S b/jmp.S index cac36363..5a834d5c 100644 --- a/jmp.S +++ b/jmp.S @@ -29,6 +29,11 @@ #define DEFUN(NAME) \ .global _ ## NAME ; \ _ ## NAME: ; +#elif __APPLE__ && __arm64__ +#define DEFUN(NAME) \ +.globl _ ## NAME %% \ +.p2align 2 %% \ +_ ## NAME: ; #elif __APPLE__ #define DEFUN(NAME) \ .globl _ ## NAME ; \ @@ -295,7 +300,11 @@ DEFUN(jmp_restore) mr %r3, %r4 blr -#elif __aarch64__ +#elif __aarch64__ || __arm64__ + +#if __APPLE__ + .section __TEXT,__text,regular,pure_instructions +#endif DEFUN(jmp_save) stp x19, x20, [x0, 0] @@ -329,6 +338,10 @@ DEFUN(jmp_restore) mov w0, w1 br x30 +#if __APPLE__ + .subsections_via_symbols +#endif + #elif _MIPS_SZPTR == 32 .set noreorder -- cgit v1.2.3