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