diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-10-21 17:42:06 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-10-21 17:42:06 +0000 |
commit | 4fba04942da8f687867af270b49dbb53881f2dd6 (patch) | |
tree | ebf9cd76361c29c0b2c2ded72a055c4fc8864300 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | |
parent | 0840214c8451c233b6a352db178e3abecc89bf3c (diff) | |
download | bcm5719-llvm-4fba04942da8f687867af270b49dbb53881f2dd6.tar.gz bcm5719-llvm-4fba04942da8f687867af270b49dbb53881f2dd6.zip |
Improving MCJIT/RuntimeDyld thread safety
llvm-svn: 193094
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 07de4ba8cd5..f40bed1b3fe 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -19,6 +19,7 @@ #include "RuntimeDyldMachO.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/MutexGuard.h" #include "llvm/Object/ELF.h" using namespace llvm; @@ -37,6 +38,8 @@ void RuntimeDyldImpl::deregisterEHFrames() { // Resolve the relocations for all symbols we currently know about. void RuntimeDyldImpl::resolveRelocations() { + MutexGuard locked(lock); + // First, resolve relocations associated with external symbols. resolveExternalSymbols(); @@ -57,6 +60,7 @@ void RuntimeDyldImpl::resolveRelocations() { void RuntimeDyldImpl::mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress) { + MutexGuard locked(lock); for (unsigned i = 0, e = Sections.size(); i != e; ++i) { if (Sections[i].Address == LocalAddress) { reassignSectionAddress(i, TargetAddress); @@ -73,6 +77,8 @@ ObjectImage *RuntimeDyldImpl::createObjectImage(ObjectBuffer *InputBuffer) { } ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) { + MutexGuard locked(lock); + OwningPtr<ObjectImage> obj(createObjectImage(InputBuffer)); if (!obj) report_fatal_error("Unable to create object image from memory buffer!"); |