New set of functions in ExecutionEngine C API allows to create custom memory manager
based on the SectionMemoryManager with some of methods overridden by user.
Supprot for LLVM RTTI was added to memory managers hierarchy as this is necessary for
easy implementation of functions that call parent methods.
This change is useful e.g. for implementing custom JIT with the need of symbol resolution
similar to the one from MCJIT variant of the Kaleidoscope tutorial. SectionMemoryManager
can be reused in this case with only getSymbolAddress overriden with the appropriate callback.
This patch is taken with minor changes from my Rust LLVM bindings (https://github.com/jauhien/iron-llvm) used at the moment in the Rust LLVM Kaleidoscope tutorial (https://github.com/jauhien/iron-kaleidoscope). There a relevant example of real use can be found (https://github.com/jauhien/iron-llvm/blob/master/src/execution_engine/{memory_manager.rs,wrappers.rs} and https://github.com/jauhien/iron-kaleidoscope/blob/master/src/jitter.rs).
What will ErrMsg's lifetime be (or who owns it after the callback returns)? Also, how would use of alloc_jemalloc affect this (w.r.t. Rust)?