From 4923eea4f6a5c547cfa87e2da7ba788100df4982 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Fri, 21 Mar 2014 07:26:41 +0000 Subject: [RuntimeDyld] Allow processRelocationRef to process more than one relocation entry at a time. Some targets require more than one relocation entry to perform a relocation. This change allows processRelocationRef to process more than one relocation entry at a time by passing the relocation iterator itself instead of just the relocation entry. Related to git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204439 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp') diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 310b206a06..5c3cc008e3 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -165,18 +165,19 @@ ObjectImage* RuntimeDyldImpl::loadObject(ObjectImage *InputObject) { StubMap Stubs; section_iterator RelocatedSection = SI->getRelocatedSection(); - if ((SI->relocation_begin() != SI->relocation_end()) || - ProcessAllSections) { - bool IsCode = false; - Check(RelocatedSection->isText(IsCode)); - SectionID = - findOrEmitSection(*Obj, *RelocatedSection, IsCode, LocalSections); - DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n"); - } + if (SI->relocation_empty() && !ProcessAllSections) + continue; + + bool IsCode = false; + Check(RelocatedSection->isText(IsCode)); + SectionID = + findOrEmitSection(*Obj, *RelocatedSection, IsCode, LocalSections); + DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n"); - for (const RelocationRef &Reloc : SI->relocations()) - processRelocationRef(SectionID, Reloc, *Obj, LocalSections, LocalSymbols, - Stubs); + for (relocation_iterator I = SI->relocation_begin(), + E = SI->relocation_end(); I != E;) + I = processRelocationRef(SectionID, I, *Obj, LocalSections, LocalSymbols, + Stubs); } // Give the subclasses a chance to tie-up any loose ends. -- cgit v1.2.3