From 25c6a0fb0755d2235d60299d356c8af5f9fff723 Mon Sep 17 00:00:00 2001 From: Pierre Tondereau Date: Sat, 20 Dec 2025 17:27:11 +0100 Subject: [PATCH 1/2] fix(bindings): patch clang-sys for preserve_none calling convention support --- Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index b07f582d0..2380662ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,3 +78,9 @@ path = "tests/module.rs" [[test]] name = "sapi_tests" path = "tests/sapi.rs" + +# Patch clang-sys to support preserve_none calling convention (libclang 19/20) +# Required for PHP 8.5+ on macOS ARM64 which uses TAILCALL VM mode +# See: https://github.com/KyleMayes/clang-sys/pull/195 +[patch.crates-io] +clang-sys = { git = "https://github.com/extphprs/clang-sys.git", branch = "preserve-none-support" } From b0040eb1c097b5837779b7ccaf38250f31fd1458 Mon Sep 17 00:00:00 2001 From: Pierre Tondereau Date: Sat, 20 Dec 2025 17:52:24 +0100 Subject: [PATCH 2/2] fix(bindings): patch bindgen and add macOS SDK path for preserve_none support --- Cargo.toml | 6 ++++-- build.rs | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2380662ac..c372e0599 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,8 +79,10 @@ path = "tests/module.rs" name = "sapi_tests" path = "tests/sapi.rs" -# Patch clang-sys to support preserve_none calling convention (libclang 19/20) +# Patch clang-sys and bindgen for preserve_none calling convention support (libclang 19/20) # Required for PHP 8.5+ on macOS ARM64 which uses TAILCALL VM mode -# See: https://github.com/KyleMayes/clang-sys/pull/195 +# - clang-sys: Adds libclang 19/20 bindings (https://github.com/KyleMayes/clang-sys/pull/195) +# - bindgen: Maps CXCallingConv_PreserveNone to C ABI [patch.crates-io] clang-sys = { git = "https://github.com/extphprs/clang-sys.git", branch = "preserve-none-support" } +bindgen = { git = "https://github.com/extphprs/rust-bindgen.git", branch = "preserve-none-support" } diff --git a/build.rs b/build.rs index f550b7b78..c740b3c4e 100644 --- a/build.rs +++ b/build.rs @@ -226,7 +226,27 @@ fn generate_bindings(defines: &[(&str, &str)], includes: &[PathBuf]) -> Result