|
The Pedigree Project
0.1
|
#include <DynamicLinker.h>
Collaboration diagram for DynamicLinker:Classes | |
| struct | SharedObject |
Public Member Functions | |
| DynamicLinker () | |
| DynamicLinker (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) |
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 37 of file DynamicLinker.h.
| DynamicLinker::DynamicLinker | ( | ) |
Creates a new DynamicLinker object.
Definition at line 53 of file DynamicLinker.cc.
| DynamicLinker::DynamicLinker | ( | DynamicLinker & | other | ) |
Creates a new DynamicLinker from another. Copies all mappings.
Definition at line 59 of file DynamicLinker.cc.
|
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 50 of file DynamicLinker.h.
Referenced by PosixSubsystem::invoke().
Here is the caller graph for this function:
|
inline |
Returns the program ELF.
Definition at line 86 of file DynamicLinker.h.
|
private |
Definition at line 32 of file amd64/DynamicLinker.cc.
References PhysicalMemoryManager::allocatePage(), ERROR, VirtualAddressSpace::Execute, Elf::getGlobalOffsetTable(), Processor::information(), PhysicalMemoryManager::instance(), NOTICE, WARNING, and VirtualAddressSpace::Write.
Referenced by loadObject(), and loadProgram().
Here is the caller graph for this function:| 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 246 of file DynamicLinker.cc.
References Elf::allocate(), List< T, nodePoolSize >::begin(), Elf::create(), Elf::createNeededOnly(), List< T, nodePoolSize >::end(), ERROR, VFS::find(), Symlink::followLink(), Symlink::fromFile(), File::getName(), initPlt(), RadixTree< T >::insert(), VFS::instance(), MemoryMapManager::instance(), File::isSymlink(), RadixTree< T >::lookup(), MemoryMapManager::mapFile(), Elf::neededLibraries(), NOTICE, and WARNING.
Referenced by 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 94 of file DynamicLinker.cc.
References Elf::allocate(), List< T, nodePoolSize >::begin(), Elf::create(), Elf::createNeededOnly(), List< T, nodePoolSize >::end(), ERROR, VFS::find(), Symlink::followLink(), Symlink::fromFile(), Elf::getInterpreter(), File::getName(), initPlt(), RadixTree< T >::insert(), VFS::instance(), MemoryMapManager::instance(), File::isSymlink(), loadObject(), RadixTree< T >::lookup(), MemoryMapManager::mapFile(), Elf::neededLibraries(), NOTICE, MemoryMapManager::unmap(), and WARNING.
|
private |
Operator= is unused and is therefore private.
| uintptr_t DynamicLinker::resolve | ( | String | name | ) |
Manually resolves a given symbol name.
Definition at line 439 of file DynamicLinker.cc.
References SymbolTable::lookup().
|
static |
Callback given to KernelCoreSyscallManager to resolve PLT relocations lazily.
Definition at line 44 of file DynamicLinker.cc.
References Processor::information(), and resolvePltSymbol().
Referenced by DLTrapHandler::trap().
Here is the caller graph for this function:
|
private |
Definition at line 98 of file amd64/DynamicLinker.cc.
References Elf::applySpecificRelocation(), ERROR, Hex, NOTICE, and SymbolTable::NotOriginatingElf.
Referenced by resolvePlt().
Here is the caller graph for this function:| bool DynamicLinker::trap | ( | uintptr_t | address | ) |
Called when a trap is handled by the DLTrapHandler.
| address | Address of the trap. |
Definition at line 367 of file DynamicLinker.cc.
References PhysicalMemoryManager::allocatePage(), ERROR, VirtualAddressSpace::Execute, PhysicalMemoryManager::getPageSize(), Processor::information(), PhysicalMemoryManager::instance(), Elf::load(), VirtualAddressSpace::map(), WARNING, and VirtualAddressSpace::Write.
Referenced by DLTrapHandler::trap().
Here is the caller graph for this function:
1.8.11