20#include "DynamicLinker.h"
21#include "pedigree/kernel/Log.h"
22#include "pedigree/kernel/panic.h"
23#include "pedigree/kernel/process/Scheduler.h"
24#include "pedigree/kernel/processor/KernelCoreSyscallManager.h"
25#include "pedigree/kernel/processor/PhysicalMemoryManager.h"
26#include "pedigree/kernel/processor/Processor.h"
27#include "pedigree/kernel/processor/VirtualAddressSpace.h"
28#include "pedigree/kernel/utilities/StaticString.h"
30#include "modules/Module.h"
31#include "modules/system/vfs/VFS.h"
33extern "C" void resolveSymbol(
void);
39 if (
reinterpret_cast<uintptr_t
>(got) == value) {
46 *got = value & 0xFFFFFFFF;
51 uintptr_t resolveLocation = 0;
57 for (uintptr_t i = 0x40000000; i < 0x50000000; i += pageSize) {
68 if (resolveLocation == 0) {
69 ERROR(
"DynamicLinker: nowhere to put resolve function.");
78 ERROR(
"DynamicLinker: Could not map resolve function.");
83 MemoryCopy(
reinterpret_cast<uint8_t*
>(resolveLocation),
84 reinterpret_cast<uint8_t*
>(&::resolveSymbol), pageSize);
86 *got = resolveLocation;
90uintptr_t DynamicLinker::resolvePltSymbol(uintptr_t libraryId, uintptr_t symIdx) {
93 uintptr_t loadBase = libraryId;
98 SharedObject* pSo = m_Objects.lookup(libraryId);
104 ERROR(
"DynamicLinker::resolvePltSymbol: No library found for id `" <<
Hex << libraryId <<
"'");
void initPlt(Elf *pElf, uintptr_t value)
uintptr_t applySpecificRelocation(uintptr_t off, SymbolTable *pSymtab, uintptr_t loadBase, SymbolTable::Policy policy=SymbolTable::LocalFirst)
uintptr_t getGlobalOffsetTable()
virtual physical_uintptr_t allocatePage(size_t pageConstraints=0)=0
static PhysicalMemoryManager & instance()
static constexpr size_t getPageSize() PURE
static ProcessorInformation & information()
static const size_t Write