summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-03-23 23:28:47 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-03-23 23:28:47 -0700
commit500155609621d8021d73291d2369b28919386a69 (patch)
tree99dc92b133ac6a8edc96b30f3ade1a66c0b288fa
parentcc966e1590332779e66d067c12ef79291dceafae (diff)
downloadtxr-500155609621d8021d73291d2369b28919386a69.tar.gz
txr-500155609621d8021d73291d2369b28919386a69.tar.bz2
txr-500155609621d8021d73291d2369b28919386a69.zip
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.
-rwxr-xr-xconfigure2
-rw-r--r--jmp.S15
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