Skip to content

Commit 269b7df

Browse files
fix bindgen vs clang preserve_none (#3583)
1 parent 434d817 commit 269b7df

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

profiling/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ fn generate_bindings(php_config_includes: &str, fibers: bool, zend_error_observe
257257
.blocklist_item("zend_result")
258258
.blocklist_item("zend_register_extension")
259259
.blocklist_item("_zend_string")
260+
// Block typedefs that use __attribute__((preserve_none)) calling convention.
261+
// PHP 8.5.1+ on macOS enables TAILCALL VM when compiled with Clang 18+,
262+
// which uses preserve_none for opcode handlers. Bindgen doesn't support
263+
// CXCallingConv_PreserveNone (CC 20) and panics. We use opaque pointers
264+
// instead of the actual function signatures because: 1) we never call
265+
// these opcode handlers from Rust, and 2) Rust cannot express the
266+
// preserve_none calling convention anyway.
267+
.blocklist_item("zend_vm_opcode_handler_t")
268+
.blocklist_item("zend_vm_opcode_handler_func_t")
269+
.raw_line("pub type zend_vm_opcode_handler_t = *const ::std::ffi::c_void;")
270+
.raw_line("pub type zend_vm_opcode_handler_func_t = *const ::std::ffi::c_void;")
260271
// Block a few of functions that we'll provide defs for manually
261272
.blocklist_item("datadog_php_profiling_vm_interrupt_addr")
262273
// I had to block these for some reason *shrug*

0 commit comments

Comments
 (0)