diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-10-11 21:25:48 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-10-11 21:25:48 +0000 |
commit | 528f6d787b1a847e61eb2f1114559f423fdeb68c (patch) | |
tree | 7570a5af47ba322b7fa97459017f88717c4ad35c /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | |
parent | b19b474de95112f7e0fc15ab87ad284889d19cd9 (diff) | |
download | llvm-528f6d787b1a847e61eb2f1114559f423fdeb68c.tar.gz llvm-528f6d787b1a847e61eb2f1114559f423fdeb68c.tar.bz2 llvm-528f6d787b1a847e61eb2f1114559f423fdeb68c.tar.xz |
Adding multiple object support to MCJIT EH frame handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp')
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index a438dcd879..97e03f0694 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -151,12 +151,17 @@ void DyldELFObject<ELFT>::updateSymbolAddress(const SymbolRef &SymRef, namespace llvm { -StringRef RuntimeDyldELF::getEHFrameSection() { - for (int i = 0, e = Sections.size(); i != e; ++i) { - if (Sections[i].Name == ".eh_frame") - return StringRef((const char*)Sections[i].Address, Sections[i].Size); +void RuntimeDyldELF::registerEHFrames() { + if (!MemMgr) + return; + for (int i = 0, e = UnregisteredEHFrameSections.size(); i != e; ++i) { + SID EHFrameSID = UnregisteredEHFrameSections[i]; + uint8_t *EHFrameAddr = Sections[EHFrameSID].Address; + uint64_t EHFrameLoadAddr = Sections[EHFrameSID].LoadAddress; + size_t EHFrameSize = Sections[EHFrameSID].Size; + MemMgr->registerEHFrames(EHFrameAddr, EHFrameLoadAddr, EHFrameSize); } - return StringRef(); + UnregisteredEHFrameSections.clear(); } ObjectImage *RuntimeDyldELF::createObjectImage(ObjectBuffer *Buffer) { @@ -1342,7 +1347,8 @@ uint64_t RuntimeDyldELF::findGOTEntry(uint64_t LoadAddress, return 0; } -void RuntimeDyldELF::finalizeLoad() { +void RuntimeDyldELF::finalizeLoad(ObjSectionToIDMap &SectionMap) { + // If necessary, allocate the global offset table if (MemMgr) { // Allocate the GOT if necessary size_t numGOTEntries = GOTEntries.size(); @@ -1365,6 +1371,18 @@ void RuntimeDyldELF::finalizeLoad() { else { report_fatal_error("Unable to allocate memory for GOT!"); } + + // Look for and record the EH frame section. + ObjSectionToIDMap::iterator i, e; + for (i = SectionMap.begin(), e = SectionMap.end(); i != e; ++i) { + const SectionRef &Section = i->first; + StringRef Name; + Section.getName(Name); + if (Name == ".eh_frame") { + UnregisteredEHFrameSections.push_back(i->second); + break; + } + } } bool RuntimeDyldELF::isCompatibleFormat(const ObjectBuffer *Buffer) const { |