class MmapLoader
Defined at line 23 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
Public Methods
void MmapLoader ()
Defined at line 69 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
void MmapLoader (size_t page_size)
Defined at line 71 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
void MmapLoader (size_t page_size)
Defined at line 71 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
void MmapLoader (MmapLoader && other)
Defined at line 73 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
MmapLoader & operator= (MmapLoader && other)
Defined at line 76 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
void ~MmapLoader ()
Defined at line 82 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
size_t page_size ()
Defined at line 88 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
template <class Diagnostics, class LoadInfo>
bool Load (Diagnostics & diag, const LoadInfo & load_info, int fd)
This takes a LoadInfo object describing segments to be mapped in and an opened fd
from which the file contents should be mapped. It returns true on success and false otherwise,
in which case a diagnostic will be emitted to diag.
When Load() is called, one should assume that the address space of the caller has a new mapping
whether the call succeeded or failed. The mapping is tied to the lifetime of the MmapLoader
until Commit() is called. Without committing, the destructor of the MmapLoader will destroy the
mapping.
Logically, Commit() isn't sensible after Load has failed.
Defined at line 101 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
uintptr_t load_bias ()
After Load(), this is the bias added to the given LoadInfo::vaddr_start()
to find the runtime load address.
Defined at line 184 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
DirectMemory & memory ()
This returns the DirectMemory of the mapping created by Load(). It should not be used after
destruction or after Commit(). If Commit() has been called before destruction then the
address range will continue to be usable, in which case one should save the object's
image() before Commit().
Defined at line 192 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h
template <class Region>
Relro Commit (const Region & relro_bounds)
Commit is used to keep the mapping created by Load around even after the
MmapLoader object is destroyed. It takes a RELRO region as returned by
LoadInfo::RelroBounds, and yields a Relro object (see above). This method
is inherently the last thing called on the object if it is used. Use like
`auto relro = std::move(loader).Commit(relro_bounds);`. After any
relocation modifications to mapped segment memory, call
`std::move(relro).Commit();`.
Defined at line 202 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h