OSDN Git Service

[Orc] Refactor ObjectLinkingLayer::addObjectSet to defer loading objects until
authorLang Hames <lhames@gmail.com>
Tue, 19 Jan 2016 21:06:38 +0000 (21:06 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 19 Jan 2016 21:06:38 +0000 (21:06 +0000)
commit1665b573d93b237bf81110a7981282a7ea343bf6
tree96062f1d535a3b9ab66f6db70de4bf1f8cfc900e
parent96068f979145efbd5ed743fb32f6734c7ece0349
[Orc] Refactor ObjectLinkingLayer::addObjectSet to defer loading objects until
they're needed.

Prior to this patch objects were loaded (via RuntimeDyld::loadObject) when they
were added to the ObjectLinkingLayer, but were not relocated and finalized until
a symbol address was requested. In the interim, another object could be loaded
and finalized with the same memory manager, causing relocation/finalization of
the first object to fail (as the first finalization call may have marked the
allocated memory for the first object read-only).

By deferring the loadObject call (and subsequent memory allocations) until an
object file is needed we can avoid prematurely finalizing memory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258185 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ExecutionEngine/JITSymbolFlags.h
include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp