|
The Pedigree Project 0.1
|
#include <DynamicLinker.h>
Collaboration diagram for DynamicLinker:Classes | |
| struct | SharedObject |
Public Member Functions | |
| DynamicLinker () | |
| DynamicLinker (const DynamicLinker &other) | |
| bool | checkInterpreter (File *pFile, String &actualFilename) |
| bool | checkDependencies (File *pFile) |
| bool | loadProgram (File *pFile, bool bDryRun=false, bool bInterpreter=false, String *sInterpreter=0) |
| bool | loadObject (File *pFile, bool bDryRun=false) |
| bool | trap (uintptr_t address) |
| Elf * | getProgramElf () |
| uintptr_t | resolve (String name) |
Static Public Member Functions | |
| static uintptr_t | resolvePlt (SyscallState &state) |
Private Member Functions | |
| DynamicLinker & | operator= (const DynamicLinker &) |
| uintptr_t | resolvePltSymbol (uintptr_t libraryId, uintptr_t symIdx) |
| void | initPlt (Elf *pElf, uintptr_t value) |
Static Private Member Functions | |
| static bool | loadDemandPage (Elf *pElf, uintptr_t buffer, size_t size, uintptr_t offset, SymbolTable *pSymbols, uintptr_t address) |
Private Attributes | |
| Elf * | m_pProgramElf |
| uintptr_t | m_ProgramStart |
| size_t | m_ProgramSize |
| uintptr_t | m_ProgramBuffer |
| RadixTree< void * > | m_LoadedObjects |
| Tree< uintptr_t, SharedObject * > | m_Objects |
The dynamic linker tracks instances of shared objects through an address space.
Definition at line 39 of file DynamicLinker.h.
| DynamicLinker::DynamicLinker | ( | ) |
Creates a new DynamicLinker object.
Definition at line 138 of file DynamicLinker.cc.
| DynamicLinker::~DynamicLinker | ( | ) |
Definition at line 164 of file DynamicLinker.cc.
| DynamicLinker::DynamicLinker | ( | const DynamicLinker & | other | ) |
Creates a new DynamicLinker from another. Copies all mappings.
Definition at line 146 of file DynamicLinker.cc.
References Tree< K, E >::begin(), and Tree< K, E >::end().
|
inline |
Checks dependencies for a given program. Returns true if all dependencies are available and loadable, false if not.
Definition at line 57 of file DynamicLinker.h.
Checks the given program for a requested interpreter, that we should run instead of loading the binary ourselves.
Definition at line 51 of file DynamicLinker.h.
|
inline |
Returns the program ELF.
Definition at line 84 of file DynamicLinker.h.
|
private |
Definition at line 32 of file amd64/DynamicLinker.cc.
References PhysicalMemoryManager::allocatePage(), VirtualAddressSpace::Execute, Elf::getGlobalOffsetTable(), PhysicalMemoryManager::getPageSize(), ProcessorBase::information(), PhysicalMemoryManager::instance(), and VirtualAddressSpace::Write.
Referenced by loadObject(), and loadProgram().
Here is the caller graph for this function:
|
staticprivate |
Definition at line 441 of file DynamicLinker.cc.
| bool DynamicLinker::loadObject | ( | File * | pFile, |
| bool | bDryRun = false |
||
| ) |
Loads a shared object into this address space (along with any dependencies.
| pFile | The ELF object to load. |
Definition at line 315 of file DynamicLinker.cc.
References Elf::allocate(), List< T, nodePoolSize >::begin(), Elf::create(), Elf::createNeededOnly(), List< T, nodePoolSize >::end(), VFS::findRetained(), Symlink::followLinkRetained(), Symlink::fromFile(), File::getName(), initPlt(), RadixTree< T >::insert(), MemoryMapManager::instance(), VFS::instance(), File::isSymlink(), loadObject(), RadixTree< T >::lookup(), MemoryMapManager::mapFile(), Elf::neededLibraries(), and MemoryMapManager::unmap().
Referenced by loadObject(), and loadProgram().
Here is the caller graph for this function:| bool DynamicLinker::loadProgram | ( | File * | pFile, |
| bool | bDryRun = false, |
||
| bool | bInterpreter = false, |
||
| String * | sInterpreter = 0 |
||
| ) |
Loads the main program. This must be an ELF file, and the linker will also load all library dependencies. If any of these loads fails, false is returned.
| pFile | The ELF file. |
Definition at line 178 of file DynamicLinker.cc.
References Elf::allocate(), List< T, nodePoolSize >::begin(), Elf::create(), Elf::createNeededOnly(), List< T, nodePoolSize >::end(), VFS::findRetained(), Symlink::followLinkRetained(), Symlink::fromFile(), Elf::getInterpreter(), File::getName(), initPlt(), RadixTree< T >::insert(), MemoryMapManager::instance(), VFS::instance(), File::isSymlink(), loadObject(), RadixTree< T >::lookup(), MemoryMapManager::mapFile(), Elf::neededLibraries(), and MemoryMapManager::unmap().
|
private |
Operator= is unused and is therefore private.
| uintptr_t DynamicLinker::resolve | ( | String | name | ) |
Manually resolves a given symbol name.
Definition at line 551 of file DynamicLinker.cc.
References SymbolTable::lookup().
|
static |
Callback given to KernelCoreSyscallManager to resolve PLT relocations lazily.
Definition at line 131 of file DynamicLinker.cc.
References Process::getParent(), and ProcessorBase::information().
|
private |
Definition at line 86 of file amd64/DynamicLinker.cc.
| bool DynamicLinker::trap | ( | uintptr_t | address | ) |
Called when a trap is handled by the DLTrapHandler.
| address | Address of the trap. |
Definition at line 511 of file DynamicLinker.cc.
References EMIT_IF.
Referenced by DLTrapHandler::trap().
Here is the caller graph for this function:
|
private |
Definition at line 128 of file DynamicLinker.h.
|
private |
Definition at line 130 of file DynamicLinker.h.
|
private |
Definition at line 124 of file DynamicLinker.h.
|
private |
Definition at line 127 of file DynamicLinker.h.
|
private |
Definition at line 126 of file DynamicLinker.h.
|
private |
Definition at line 125 of file DynamicLinker.h.