Re:Neat Rust Tricks: Passing Closures to C
by saagarjha on Monday November 25, 2019 @08:26PM
(#21634861)
Right, this is how Objective-C's implementation works, except it keeps around one page of trampolines and remaps that around when necessary to be able to "create" more trampolines on the fly, I believe.
Or if the OS doesn't support W+X allocation at all, then you can have a bunch of tightly packed pregenerated trampolines in the binary.