[ORC] Add errors for missing and extraneous symbol definitions.
authorLang Hames <lhames@gmail.com>
Sat, 22 Feb 2020 01:38:42 +0000 (17:38 -0800)
committerLang Hames <lhames@gmail.com>
Sat, 22 Feb 2020 19:49:14 +0000 (11:49 -0800)
commit81726894d3c8af556eb86007c8c26d7e2d9639f3
treeaae7147063686f499249069a753a821f6293ee01
parent56eb15a1c71061043d50aa669407816bc08dfb5d
[ORC] Add errors for missing and extraneous symbol definitions.

This patch adds new errors and error checking to the ObjectLinkingLayer to
catch cases where a compiled or loaded object either:
(1) Contains definitions not covered by its responsibility set, or
(2) Is missing definitions that are covered by its responsibility set.

Proir to this patch providing the correct set of definitions was treated as
an API contract requirement, however this requires that the client be confident
in the correctness of the whole compiler / object-cache pipeline and results
in difficult-to-debug assertions upon failure. Treating this as a recoverable
error results in clearer diagnostics.

The performance overhead of this check is one comparison of densemap keys
(symbol string pointers) per linking object, which is minimal. If this overhead
ever becomes a problem we can add the check under a flag that can be turned off
if the client fully trusts the rest of the pipeline.
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/include/llvm/ExecutionEngine/Orc/OrcError.h
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
llvm/lib/ExecutionEngine/OrcError/OrcError.cpp