See #31521
Contained-Commits:
[ORC] Extend object layer callbacks so JITEventListener can be supported.
Currently the RTDyldObjectLinkingLayer makes it hard to support
JITEventListeners. Which in turn means debugging and profiling JIT
generated code hard.
Supporting JITEventListeners at minimum requries a freed
callback (added).
As listeners expect the ObjectFile to be passed as well, an adaptor
between RTDyldObjectLinkingLayer and JITEventListeners would currently
need to also maintain ObjectFiles for all loaded modules. To make that
less awkward extend the callbacks to pass the ObjectFile to both
Finalized and Freed callbacks. That requires extending the lifetime
of the object file when callbacks are present.
[ORC] Add ability [un]register JITEventListener on C Orc stack.
[ORC][C-API] Expose LLVMOrc{Unr,R}egisterJITEventListener().
[C-API] Add functions to create GDB, Intel, Oprofile event listeners.
Intel and Oprofile were done blindly, I don't have the environment to
build them.