An LLVMSharp user filed a bug report (https://github.com/mjsabby/LLVMSharp/issues/3) that using the library they were unable to call SetGC("shadow-stack") on a function and then subsequently ask MCJIT to finalize the object containing the function.
They also created an LLVM bug report (https://llvm.org/bugs/show_bug.cgi?id=23095) that demonstrates the problem.
I have investigated the root cause for this and it is because LLVMSharp and other C binding users do not have access to llvm::linkShadowStackGC (in addition to other GCs defined in llvm/include/llvm/CodeGen/GCs.h) which GC clients of the C++ API would need to call in order to successfully complete this scenario.
I'm proposing to expose LLVMLinkShadowStackGC via the C bindings. The ShadowStackGC is very useful functionality that is referenced in the official documentation and likely to be beneficial to many users.
I'm consciously choosing not to link other GCs, but maybe I should? Let me know as part of the review feedback if I should also expose other GCs (currently StatepointExample, Erlang, and Ocaml)
Two comments: