Deps: macOS: Fix libffi build error on Xcode 16.3 / Apple Clang 17

This PR adds a simple patch to fix libffi compilation errors on Xcode
16.3 / Apple Clang 17. This patch has been ported from libffi Github
PR #857[1] and has now since been included in libffi 3.4.7

[1]: https://github.com/libffi/libffi/pull/857

The reason why we patch libffi v3.4.4 instead of just upgrading to 3.4.7
is that Python require specific versions of its dependencies. (See
comment in build_environment/cmake/versions.cmake about updating Python
version)

Once we upgrade Python and libffi is updated to 3.4.7 or beyond,
this patch can be safely removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136934
This commit is contained in:
Jonas Holzman
2025-04-03 18:37:30 +02:00
parent 73a466c44f
commit 31175ccf19
2 changed files with 39 additions and 1 deletions

View File

@@ -26,7 +26,11 @@ ExternalProject_Add(external_ffi
PATCH_COMMAND ${PATCH_CMD} -p 0 -d
${BUILD_DIR}/ffi/src/external_ffi <
${PATCH_DIR}/ffi.diff
${PATCH_DIR}/ffi.diff &&
# Fix compilation errors on Apple Clang >= 17, remove when FFI is updated beyond 3.4.7, see PR #136934 for details.
${PATCH_CMD} -p 1 -d
${BUILD_DIR}/ffi/src/external_ffi <
${PATCH_DIR}/ffi_apple_clang_17.diff
INSTALL_DIR ${LIBDIR}/ffi
)

View File

@@ -0,0 +1,34 @@
diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
index eeaf3f8..329889c 100644
--- a/src/aarch64/sysv.S
+++ b/src/aarch64/sysv.S
@@ -76,8 +76,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
x5 closure
*/
- cfi_startproc
CNAME(ffi_call_SYSV):
+ cfi_startproc
/* Sign the lr with x1 since that is where it will be stored */
SIGN_LR_WITH_REG(x1)
@@ -268,8 +268,8 @@ CNAME(ffi_closure_SYSV_V):
#endif
.align 4
- cfi_startproc
CNAME(ffi_closure_SYSV):
+ cfi_startproc
SIGN_LR
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
@@ -500,8 +500,8 @@ CNAME(ffi_go_closure_SYSV_V):
#endif
.align 4
- cfi_startproc
CNAME(ffi_go_closure_SYSV):
+ cfi_startproc
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
cfi_rel_offset (x29, 0)