[Orc] Add a method for ObjectLinkingLayer to return ownership of object buffers.

RTDyldObjectLinkingLayer allowed clients to register a NotifyEmitted function to
reclaim ownership of object buffers once they had been linked. This patch adds
similar functionality to ObjectLinkingLayer: Clients can now optionally call the
ObjectLinkingLayer::setReturnObjectBuffer method to register a function that
will be called when discarding object buffers. If set, this function will be
called to return ownership of the object regardless of whether the link
succeeded or failed.

Use cases for this function include debug dumping (it provides a way to dump
all objects linked into JIT'd code) and object re-use (e.g. storing an
object in a cache).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374951 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed