20 #include "DynamicLinker.h" 21 #include "modules/Module.h" 22 #include "modules/system/vfs/VFS.h" 23 #include "pedigree/kernel/Log.h" 24 #include "pedigree/kernel/panic.h" 25 #include "pedigree/kernel/process/Scheduler.h" 26 #include "pedigree/kernel/processor/KernelCoreSyscallManager.h" 27 #include "pedigree/kernel/processor/PhysicalMemoryManager.h" 28 #include "pedigree/kernel/processor/Processor.h" 29 #include "pedigree/kernel/processor/VirtualAddressSpace.h" 30 #include "pedigree/kernel/utilities/StaticString.h" 32 extern "C" void resolveSymbol(
void);
42 if (reinterpret_cast<uintptr_t>(got) == value)
44 WARNING(
"DynamicLinker: Global offset table not found!");
49 *got = value & 0xFFFFFFFF;
55 uintptr_t resolveLocation = 0;
60 for (uintptr_t i = 0x40000000; i < 0x50000000;
65 reinterpret_cast<void *>(i)))
75 if (resolveLocation == 0)
77 ERROR(
"DynamicLinker: nowhere to put resolve function.");
81 physical_uintptr_t physPage =
84 physPage, reinterpret_cast<void *>(resolveLocation),
89 ERROR(
"DynamicLinker: Could not map resolve function.");
95 reinterpret_cast<uint8_t *>(resolveLocation),
96 reinterpret_cast<uint8_t *>(&::resolveSymbol),
99 *got = resolveLocation;
107 uintptr_t loadBase = libraryId;
110 pElf = m_pProgramElf;
113 SharedObject *pSo = m_Objects.lookup(libraryId);
121 "DynamicLinker::resolvePltSymbol: No library found for id `" 122 <<
Hex << libraryId <<
"'");
127 symIdx, m_pProgramElf->getSymbolTable(), loadBase);
130 symIdx, m_pProgramElf->getSymbolTable(), loadBase,
static PhysicalMemoryManager & instance()
virtual physical_uintptr_t allocatePage(size_t pageConstraints=0)=0
static ProcessorInformation & information()
static const size_t Write
uintptr_t resolvePltSymbol(uintptr_t libraryId, uintptr_t symIdx)
uintptr_t applySpecificRelocation(uintptr_t off, SymbolTable *pSymtab, uintptr_t loadBase, SymbolTable::Policy policy=SymbolTable::LocalFirst)
uintptr_t getGlobalOffsetTable()
void initPlt(Elf *pElf, uintptr_t value)