[ORC] Add utilities to RTDyldObjectLinkingLayer2 to simplify symbol flag
authorLang Hames <lhames@gmail.com>
Fri, 31 Aug 2018 00:53:17 +0000 (00:53 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 31 Aug 2018 00:53:17 +0000 (00:53 +0000)
commit6d32002e2bb0897836618f9ddb0b320a83583316
treea1a265bd7ff46d1bf0ea7412b4ba46d1ddb48345
parentf1126325e8f6b26514ea2bc75b7db81cc2e5cccf
[ORC] Add utilities to RTDyldObjectLinkingLayer2 to simplify symbol flag
management and materialization responsibility registration.

The setOverrideObjectFlagsWithResponsibilityFlags method instructs
RTDyldObjectlinkingLayer2 to override the symbol flags produced by RuntimeDyld with
the flags provided by the MaterializationResponsibility instance. This can be used
to enable symbol visibility (hidden/exported) for COFF object files, which do not
currently support the SF_Exported flag.

The setAutoClaimResponsibilityForObjectSymbols method instructs
RTDyldObjectLinkingLayer2 to claim responsibility for any symbols provided by a
given object file that were not already in the MaterializationResponsibility
instance. Setting this flag allows higher-level program representations (e.g.
LLVM IR) to be added based on only a subset of the symbols they provide, without
having to write intervening layers to scan and add the additional symbols. This
trades diagnostic quality for convenience however: If all symbols are enumerated
up-front then clashes can be detected and reported early. If this option is set,
clashes for the additional symbols may not be detected until late, and detection
may depend on the flow of control through JIT'd code.

llvm-svn: 341154
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayer2Test.cpp