template <class Elf = elfldltl::Elf<>, RemoteLoadZygote Zygote = RemoteLoadZygote::kNo>
class RemoteLoadModule
Defined at line 42 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
Also known as RemoteDynamicLinker::Module.
Public Methods
void RemoteLoadModule<Elf, Zygote> ()
Defined at line 142 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void RemoteLoadModule<Elf, Zygote> (const RemoteLoadModule<Elf, Zygote> & )
Defined at line 144 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void RemoteLoadModule<Elf, Zygote> (RemoteLoadModule<Elf, Zygote> && )
Defined at line 146 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void RemoteLoadModule<Elf, Zygote> (const Soname & name, std::optional<uint32_t> loaded_by_modid)
Defined at line 148 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
RemoteLoadModule<Elf, Zygote> & operator= (RemoteLoadModule<Elf, Zygote> && other)
Defined at line 154 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
const DecodedPtr & decoded_module ()
Defined at line 156 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void set_symbol_filter (SymbolFilter filter)
Set the callback used to lookup symbols in this module for relocation (of
itself if done before Relocate(), and of other modules relocated later).
The API contract for SymbolFilter is described above.
Defined at line 161 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
const SymbolFilter & symbol_filter ()
Defined at line 165 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
const Module & module ()
Note this shadows LoadModule::module(), so module() calls in the methods
of class and its subclasses return module_ but module() calls in the
LoadModule base class return the immutable decoded().module() instead.
The only uses LoadModule's own methods make of module() are for the data
that is not specific to a particular dynamic linking session: data
independent of module name, load bias, and TLS and symbolizer ID numbers.
Defined at line 173 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
Module & module ()
Defined at line 177 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
size_type tls_module_id ()
This is set by the set_decoded method, below.
Defined at line 183 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
size_type load_bias ()
This is set by the Allocate method, below.
Defined at line 186 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
const LoadInfo & load_info ()
This is only set by the Relocate method, below. Before relocation is
complete, consult decoded().load_info() for layout information. The
difference between load_info() and decoded().load_info() is that mutable
segment VMOs contain relocated data specific to this RemoteLoadModule
where as RemoteDecodedModule only has per-segment VMOs for partial-page
zeroing, and those must stay immutable.
Defined at line 194 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
LoadInfo & load_info ()
Defined at line 195 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void set_name (const Soname & name)
Defined at line 197 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void set_name (std::string_view name)
Defined at line 201 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
std::optional<uint32_t> loaded_by_modid ()
Return the index of other module in the list (if any) that requested this
one be loaded. This means that the name() string points into that other
module's DT_STRTAB image.
Defined at line 209 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void set_loaded_by_modid (std::optional<uint32_t> loaded_by_modid)
Change the module ID (i.e. List index) recording which other module (if
any) first requested this module be loaded via DT_NEEDED. This is
normally set in construction at the time of that first request, but for
predecoded modules it needs to be updated in place.
Defined at line 215 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
template <class Diagnostics>
bool Allocate (Diagnostics & diag, const zx::vmar & vmar, std::optional<size_t> vmar_offset)
Initialize the loader and allocate the address region for the module,
updating the module's runtime address fields on success. The optional
vmar_offset argument can pick the load address used, in terms of the
offset within the containing VMAR. The kernel chooses by default.
Defined at line 224 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void Preplaced (size_type load_bias)
Before Allocate() is called, this can be used to store a chosen vaddr that
RemoteDynamicLinker can fetch back to compute the vmar_offset to pass to
Allocate().
Defined at line 253 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void Preloaded (size_type load_bias)
As an alternative to calling Allocate(), instead mark this module as
already loaded with a known load bias.
Defined at line 260 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
std::optional<size_type> preplaced ()
Returns the absolute vaddr_start if Preplaced() or Preloaded() was called.
Defined at line 270 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
bool preloaded ()
Returns true if Preloaded() was called rather than Allocate().
Defined at line 278 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
template <class Diagnostics>
bool PrepareLoadInfo (Diagnostics & diag)
Before relocation can mutate any segments, load_info() needs to be set up
with its own copies of the segments, including copy-on-write cloning any
per-segment VMOs that decoded() owns. This can be done earlier if the
segments need to be adjusted before relocation.
Defined at line 285 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
template <elfldltl::ElfMachine Machine, class Diagnostics, class ModuleList, typename TlsDescResolver>
bool Relocate (Diagnostics & diag, ModuleList & modules, const TlsDescResolver & tls_desc_resolver)
Defined at line 304 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
template <class Diagnostics>
bool Load (Diagnostics & diag)
Load the module into its allocated vaddr region.
This is a no-op if Prelaoded() was called instead of Allocate().
Defined at line 332 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void Commit ()
This must be the last method called with the loader. Direct the loader to
preserve the load image before it is garbage collected.
Defined at line 339 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
void set_decoded (DecodedPtr decoded, uint32_t modid, bool symbols_visible, size_type & max_tls_modid)
Defined at line 349 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h
template <auto& diag>
LookupResult Lookup (auto & diag, elfldltl::SymbolName & name)
This meets the Module API for elfldltl::MakeSymbolResolver, overriding the
LoadModule definition.
Defined at line 378 of file ../../sdk/lib/ld/include/lib/ld/remote-load-module.h