template <MmapperApi Mmapper = PosixMmapper>

class MmapLoader

Defined at line 129 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

Public Methods

void MmapLoader<Mmapper> ()

Defined at line 179 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void MmapLoader<Mmapper> (size_t page_size)

Defined at line 183 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void MmapLoader<Mmapper> (size_t page_size)

Defined at line 183 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void MmapLoader<Mmapper> (Mmapper mapper)

Defined at line 187 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void MmapLoader<Mmapper> (Mmapper mapper, size_t page_size)

Defined at line 190 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void MmapLoader<Mmapper> (Mmapper mapper, size_t page_size)

Defined at line 190 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void MmapLoader<Mmapper> (MmapLoader<Mmapper> && other)

Defined at line 193 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

MmapLoader<Mmapper> & operator= (MmapLoader<Mmapper> && other)

Defined at line 196 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

void ~MmapLoader<Mmapper> ()

Defined at line 202 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

size_t page_size ()

Defined at line 208 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

template <class Diagnostics, class LoadInfo>
bool Load (Diagnostics & diag, const LoadInfo & load_info, const Mmapper::File & 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 223 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 309 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 317 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();`.

Note this moves the Mmapper object used at construction into the returned

Relro object. That same object will be used for the MakeReadOnly call

made by Relro::Commit().

Defined at line 331 of file ../../src/lib/elfldltl/include/lib/elfldltl/mmap-loader.h

Records