Lines Matching +full:mc +full:- +full:sid

1 //===-- RuntimeDyld.cpp - Run-time dynamic linker for MC-JIT ----*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Implementation of the MC-JIT runtime dynamic linker.
11 //===----------------------------------------------------------------------===//
66 // Empty out-of-line virtual destructor as the key function.
82 dbgs() << "----- Contents of section " << S.getName() << " " << State in dumpSectionMemory()
83 << " -----"; in dumpSectionMemory()
95 unsigned StartPadding = LoadAddr & (ColsPerRow - 1); in dumpSectionMemory()
100 LoadAddr & ~(uint64_t)(ColsPerRow - 1)) << ":"; in dumpSectionMemory()
101 while (StartPadding--) in dumpSectionMemory()
106 if ((LoadAddr & (ColsPerRow - 1)) == 0) in dumpSectionMemory()
113 --BytesRemaining; in dumpSectionMemory()
177 Result = *AddressOrErr - Sec.getAddress(); in getOffset()
241 Expected<uint32_t> FlagsOrErr = I->getFlags(); in loadObjectImpl()
252 if (auto SymTypeOrErr = I->getType()) in loadObjectImpl()
259 if (auto NameOrErr = I->getName()) in loadObjectImpl()
273 if (JITSymFlags->isWeak() || JITSymFlags->isCommon()) { in loadObjectImpl()
284 if (JITSymFlags->isWeak()) in loadObjectImpl()
286 if (JITSymFlags->isCommon()) { in loadObjectImpl()
288 uint32_t Align = I->getAlignment(); in loadObjectImpl()
289 uint64_t Size = I->getCommonSize(); in loadObjectImpl()
300 if (auto AddrOrErr = I->getAddress()) in loadObjectImpl()
308 << " SID: " << SectionID in loadObjectImpl()
315 processNewSymbol(*I, Result.first->getValue()); in loadObjectImpl()
323 if (auto SIOrErr = I->getSection()) in loadObjectImpl()
336 bool IsCode = SI->isText(); in loadObjectImpl()
345 << " SID: " << SectionID in loadObjectImpl()
352 processNewSymbol(*I, Result.first->getValue()); in loadObjectImpl()
368 Expected<section_iterator> RelSecOrErr = SI->getRelocatedSection(); in loadObjectImpl()
376 relocation_iterator I = SI->relocation_begin(); in loadObjectImpl()
377 relocation_iterator E = SI->relocation_end(); in loadObjectImpl()
382 bool IsCode = RelocatedSection->isText(); in loadObjectImpl()
440 bool IsCode = SI->isText(); in loadObjectImpl()
449 // Give the subclasses a chance to tie-up any loose ends. in loadObjectImpl()
454 // llvm::dbgs() << "Added: " << E.first.getRawDataRefImpl() << " -> " << E.second << "\n"; in loadObjectImpl()
476 const coff_section *CoffSection = COFFObj->getCOFFSection(Section); in isRequiredForExecution()
477 // Avoid loading zero-sized COFF sections. in isRequiredForExecution()
483 (CoffSection->VirtualSize > 0) || (CoffSection->SizeOfRawData > 0); in isRequiredForExecution()
485 CoffSection->Characteristics & in isRequiredForExecution()
500 return ((COFFObj->getCOFFSection(Section)->Characteristics & in isReadOnlyData()
517 return COFFObj->getCOFFSection(Section)->Characteristics & in isZeroInit()
521 unsigned SectionType = MachO->getSectionType(Section); in isZeroInit()
571 PaddingSize += getStubAlignment().value() - 1; in computeTotalAllocSize()
612 Expected<uint32_t> FlagsOrErr = I->getFlags(); in computeTotalAllocSize()
618 uint64_t Size = I->getCommonSize(); in computeTotalAllocSize()
619 Align Alignment = Align(I->getAlignment()); in computeTotalAllocSize()
638 // (code, read-only data, read-write data) assuming that all sections are in computeTotalAllocSize()
659 for (const RelocationRef &Reloc : SI->relocations()) in computeGOTSize()
685 Expected<section_iterator> RelSecOrErr = SI->getRelocatedSection(); in computeSectionStubBufSize()
693 for (const RelocationRef &Reloc : SI->relocations()) in computeSectionStubBufSize()
706 StubBufSize += StubAlignment.value() - EndAlignment.value(); in computeSectionStubBufSize()
714 Src += Size - 1; in readBytesUnaligned()
715 while (Size--) in readBytesUnaligned()
716 Result = (Result << 8) | *Src--; in readBytesUnaligned()
718 while (Size--) in readBytesUnaligned()
727 while (Size--) { in writeBytesUnaligned()
732 Dst += Size - 1; in writeBytesUnaligned()
733 while (Size--) { in writeBytesUnaligned()
734 *Dst-- = Value & 0xFF; in writeBytesUnaligned()
852 PaddingSize += getStubAlignment().value() - 1; in emitSection()
876 // Zero-initialize or copy the data from the image in emitSection()
891 DataSize &= -(uint64_t)getStubAlignment().value(); in emitSection()
935 SectionID = i->second; in findOrEmitSection()
964 const auto &SymInfo = Loc->second; in addRelocationForSymbol()
975 // since symbol lookup won't necessarily find a handy, in-range, in createStubFunction()
987 // and stubs for branches Thumb - ARM and ARM - Thumb. in createStubFunction()
988 writeBytesUnaligned(0xe51ff004, Addr, 4); // ldr pc, [pc, #-4] in createStubFunction()
1064 // 8-byte address stored at Addr + 8 in createStubFunction()
1069 // 32-bit PC-relative address of the GOT entry will be stored at Addr+2 in createStubFunction()
1071 *Addr = 0xE9; // 32-bit pc-relative jump. in createStubFunction()
1094 << " -> " << format("0x%016" PRIx64, Addr) << "\n"); in reassignSectionAddress()
1126 Addr = RRI->second.getAddress(); in applyExternalSymbolRelocations()
1127 Flags = RRI->second.getFlags(); in applyExternalSymbolRelocations()
1131 const auto &SymInfo = Loc->second; in applyExternalSymbolRelocations()
1189 auto NewSymbolsF = NewSymbolsP->get_future(); in resolveExternalSymbols()
1192 NewSymbolsP->set_value(std::move(Result)); in resolveExternalSymbols()
1200 assert(NewResolverResults->size() == NewSymbols.size() && in resolveExternalSymbols()
1239 SharedThis->applyExternalSymbolRelocations(Resolved); in finalizeAsync()
1240 SharedThis->resolveLocalRelocations(); in finalizeAsync()
1241 SharedThis->registerEHFrames(); in finalizeAsync()
1243 if (SharedThis->MemMgr.finalizeMemory(&ErrMsg)) in finalizeAsync()
1253 for (auto &RelocKV : SharedThis->ExternalSymbolRelocations) { in finalizeAsync()
1257 assert(!SharedThis->GlobalSymbolTable.count(Name) && in finalizeAsync()
1258 "Name already processed. RuntimeDyld instances can not be re-used " in finalizeAsync()
1264 SharedThis->Resolver.lookup(Symbols, std::move(PostResolveContinuation)); in finalizeAsync()
1269 //===----------------------------------------------------------------------===//
1277 return RTDyld.Sections[I->second].getLoadAddress(); in getSectionLoadAddress()
1316 Dyld->setProcessAllSections(ProcessAllSections); in createRuntimeDyldCOFF()
1317 Dyld->setNotifyStubEmitted(std::move(NotifyStubEmitted)); in createRuntimeDyldCOFF()
1327 Dyld->setProcessAllSections(ProcessAllSections); in createRuntimeDyldELF()
1328 Dyld->setNotifyStubEmitted(std::move(NotifyStubEmitted)); in createRuntimeDyldELF()
1340 Dyld->setProcessAllSections(ProcessAllSections); in createRuntimeDyldMachO()
1341 Dyld->setNotifyStubEmitted(std::move(NotifyStubEmitted)); in createRuntimeDyldMachO()
1365 if (!Dyld->isCompatibleFile(Obj)) in loadObject()
1368 auto LoadedObjInfo = Dyld->loadObject(Obj); in loadObject()
1376 return Dyld->getSymbolLocalAddress(Name); in getSymbolLocalAddress()
1381 return Dyld->getSymbolSectionID(Name); in getSymbolSectionID()
1387 return Dyld->getSymbol(Name); in getSymbol()
1393 return Dyld->getSymbolTable(); in getSymbolTable()
1396 void RuntimeDyld::resolveRelocations() { Dyld->resolveRelocations(); } in resolveRelocations()
1399 Dyld->reassignSectionAddress(SectionID, Addr); in reassignSectionAddress()
1404 Dyld->mapSectionAddress(LocalAddress, TargetAddress); in mapSectionAddress()
1407 bool RuntimeDyld::hasError() { return Dyld->hasError(); } in hasError()
1409 StringRef RuntimeDyld::getErrorString() { return Dyld->getErrorString(); } in getErrorString()
1424 return Dyld->getSectionContent(SectionID); in getSectionContent()
1429 return Dyld->getSectionLoadAddress(SectionID); in getSectionLoadAddress()
1434 Dyld->registerEHFrames(); in registerEHFrames()
1439 Dyld->deregisterEHFrames(); in deregisterEHFrames()
1442 // so that we can re-use RuntimeDyld's implementation without twisting the