aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
commitcfca06d7963fa0909f90483b42a6d7d194d01e08 (patch)
tree209fb2a2d68f8f277793fc8df46c753d31bc853b /llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
parent706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff)
downloadsrc-cfca06d7963fa0909f90483b42a6d7d194d01e08.tar.gz
src-cfca06d7963fa0909f90483b42a6d7d194d01e08.zip
Notes
Diffstat (limited to 'llvm/lib/ExecutionEngine/JITLink/JITLink.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JITLink/JITLink.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
index 6c924f889577..5105ec495148 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
@@ -10,6 +10,7 @@
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/BinaryFormat/Magic.h"
+#include "llvm/ExecutionEngine/JITLink/ELF.h"
#include "llvm/ExecutionEngine/JITLink/MachO.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
@@ -180,18 +181,14 @@ Block &LinkGraph::splitBlock(Block &B, size_t SplitIndex,
// Copy edges to NewBlock (recording their iterators so that we can remove
// them from B), and update of Edges remaining on B.
std::vector<Block::edge_iterator> EdgesToRemove;
- for (auto I = B.edges().begin(), E = B.edges().end(); I != E; ++I) {
+ for (auto I = B.edges().begin(); I != B.edges().end();) {
if (I->getOffset() < SplitIndex) {
NewBlock.addEdge(*I);
- EdgesToRemove.push_back(I);
- } else
+ I = B.removeEdge(I);
+ } else {
I->setOffset(I->getOffset() - SplitIndex);
- }
-
- // Remove edges that were transfered to NewBlock from B.
- while (!EdgesToRemove.empty()) {
- B.removeEdge(EdgesToRemove.back());
- EdgesToRemove.pop_back();
+ ++I;
+ }
}
}
@@ -304,6 +301,8 @@ void jitLink(std::unique_ptr<JITLinkContext> Ctx) {
switch (Magic) {
case file_magic::macho_object:
return jitLink_MachO(std::move(Ctx));
+ case file_magic::elf_relocatable:
+ return jitLink_ELF(std::move(Ctx));
default:
Ctx->notifyFailed(make_error<JITLinkError>("Unsupported file format"));
};