[ORC] Allow JITDylib definition generators to return Errors.
authorLang Hames <lhames@gmail.com>
Tue, 30 Apr 2019 00:03:26 +0000 (00:03 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 30 Apr 2019 00:03:26 +0000 (00:03 +0000)
commitb12867230cd84a3cf9d451a8b25f55789cc59bb3
tree24f934b3d2e2c9d9d0ae1669e2708bac1a4658fd
parent1a52eaf7733867f1e92921a057a4cace203050b1
[ORC] Allow JITDylib definition generators to return Errors.

Background: A definition generator can be attached to a JITDylib to generate
new definitions in response to queries. For example: a generator that forwards
calls to dlsym can map symbols from a dynamic library into the JIT process on
demand.

If definition generation fails then the generator should be able to return an
error. This allows the JIT API to distinguish between the case where a
generator does not provide a definition, and the case where it was not able to
determine whether it provided a definition due to an error.

The immediate motivation for this is cross-process symbol lookups: If the
remote-lookup generator is attached to a JITDylib early in the search list, and
if a generator failure is misinterpreted as "no definition in this JITDylib" then
lookup may continue and bind to a different definition in a later JITDylib, which
is a bug.

llvm-svn: 359521
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
llvm/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp