Would it be possible to define some kind of generic attributes for non-standard calls and offload the actual understanding of the swift abi to an external tool, possibly with something like procedural macro?
Adding extern "swift"
and #[mangle(swift)]
means declarations of the swift functions in rust syntax are still needed, so there would probably have to be a tool that will generate them from the actual swift code similarly to what bindgen does for C.
That tool could then understand the mangling, and emit the #[export_name = …]
s, but maybe similar approach could be used for the other features. An attribute for adding the llvm attributes, and maybe even some kind of llvm IL template that would take care of the parameter exploding?
That way the implementation of the actual swift ABI could be developed outside the actual rust compiler—without having to stick to its release schedule and being slowed down by the long CI runs—and independently of support for further ABIs like C++.