llvm.org GIT mirror llvm / 3186597
[RuntimeDyld] Make RuntimeDyldImpl::resolveExternalSymbols preserve the relocation entries it applies. Prior to this patch, RuntimeDyldImpl::resolveExternalSymbols discarded relocations for external symbols once they had been applied. This causes issues if the client calls MCJIT::finalizeLoadedModules more than once, and updates the location of any symbols in between (e.g. by calling MCJIT::mapSectionAddress). No test case yet: None of our in-tree memory managers support moving sections around. I'll have to hack up a dummy memory manager before I can write a unit test. Fixes <rdar://problem/16764378> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208257 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 6 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
619619 }
620620
621621 void RuntimeDyldImpl::resolveExternalSymbols() {
622 StringMap ProcessedSymbols;
623
622624 while (!ExternalSymbolRelocations.empty()) {
623625 StringMap::iterator i = ExternalSymbolRelocations.begin();
624626
664666 resolveRelocationList(Relocs, Addr);
665667 }
666668
669 ProcessedSymbols[i->first()] = i->second;
667670 ExternalSymbolRelocations.erase(i);
671 }
672
673 // Restore the relocation entries that were consumed in the loop above:
674 //
675 // FIXME: Replace the following loop with:
676 // std::swap(ProcessedSymbols, ExternalSymbolRelocations)
677 // once StringMap has copy and move construction.
678 for (StringMap::iterator I = ProcessedSymbols.begin(),
679 E = ProcessedSymbols.end();
680 I != E; ++I) {
681 ExternalSymbolRelocations[I->first()] = I->second;
668682 }
669683 }
670684