Skip to content

Commit 3cc98df

Browse files
committed
unix: backport a libffi aarch64 assembly fix
LLVM 19 yields a compile error without this patch.
1 parent 64ad969 commit 3cc98df

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

cpython-unix/build-libffi.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,43 @@ tar -xf libffi-${LIBFFI_VERSION}.tar.gz
1313

1414
pushd libffi-${LIBFFI_VERSION}
1515

16+
# Needed to fix compilation on macOS aarch64. Will presumably be in libffi
17+
# 3.4.7 or 3.5. Backport of libffi commit 8308bed5b2423878aa20d7884a99cf2e30b8daf7.
18+
patch -p1 <<EOF
19+
diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
20+
index fdd0e8b..1ae768b 100644
21+
--- a/src/aarch64/sysv.S
22+
+++ b/src/aarch64/sysv.S
23+
@@ -89,7 +89,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
24+
x5 closure
25+
*/
26+
27+
- cfi_startproc
28+
CNAME(ffi_call_SYSV):
29+
BTI_C
30+
/* Sign the lr with x1 since that is where it will be stored */
31+
@@ -347,8 +346,8 @@ CNAME(ffi_closure_SYSV_V):
32+
#endif
33+
34+
.align 4
35+
- cfi_startproc
36+
CNAME(ffi_closure_SYSV):
37+
+ cfi_startproc
38+
BTI_C
39+
SIGN_LR
40+
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
41+
@@ -643,8 +642,8 @@ CNAME(ffi_go_closure_SYSV_V):
42+
#endif
43+
44+
.align 4
45+
- cfi_startproc
46+
CNAME(ffi_go_closure_SYSV):
47+
+ cfi_startproc
48+
BTI_C
49+
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
50+
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
51+
EOF
52+
1653
EXTRA_CONFIGURE=
1754

1855
# mkostemp() was introduced in macOS 10.10 and libffi doesn't have

0 commit comments

Comments
 (0)