template <class Elf = elfldltl::Elf<>, elfldltl::ElfMachine Machine = elfldltl::ElfMachine::kNative>
class RemoteAbiStub
Defined at line 57 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
In the remote dynamic linking case, the passive ABI is anchored by the "stub
dynamic linker" (ld-stub.so in the build). This shared library gets loaded
as an implicit dependency to stand in for the in-process startup dynamic
linker that's usually there at runtime. Aside from the normal metadata and
a tiny code segment containing TLSDESC runtime hook code, it consists of a
final ZeroFillSegment or DataWithZeroFillSegment that holds space for the
passive ABI symbols.
The RemoteAbiStub object collects data about the layout and symbols in the
stub dynamic linker as decoded into a RemoteDecodedModule. The Init()
method examines the module and records its layout, and stores the module
RefPtr for later use. The RemoteAbiStub object can be reused or copied as
long as the same stub dynamic linker ELF file (or verbatim copy) is being
used.
This object is used by the RemoteAbiHeap to modify a RemoteLoadModule for
the specific instantiation of the stub dynamic linker for a particular
remote dynamic linking domain (or zygote thereof). The decoded_module()
pointer can be used to create that RemoteLoadModule.
RemoteAbiStub also collects a set of TLSDESC runtime entry point addresses.
These are not encoded as symbols, but obscured inside the .eh_frame table.
They are self-identifying to this code by a private protocol with the
assembly code that defines them (see
<lib
/ld/tlsdesc.h>), but in a way that
will be harmlessly ignored by other consumers of the stub dynamic linker's
.eh_frame CFI encoding such as runtime unwinders or debuggers. Users of the
RemoteAbiStub::tlsdesc_runtime methods should stay tightly coupled to the
TLSDESC runtime assembly code that's described in
<lib
/ld/tlsdesc.h> so that
the stub dynamic linker used at runtime came from the same ld library source
tree as this class.
Public Members
static auto & kFilename
Public Methods
void RemoteAbiStub<Elf, Machine> ()
Defined at line 72 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
void RemoteAbiStub<Elf, Machine> (const RemoteAbiStub<Elf, Machine> & )
Defined at line 73 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
void RemoteAbiStub<Elf, Machine> (RemoteAbiStub<Elf, Machine> && )
Defined at line 74 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
const RemoteModulePtr & decoded_module ()
This is the ld::RemoteDecodedModule for the stub dynamic
linker, the same pointer that was given to Create().
Defined at line 84 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
size_type data_vaddr ()
Return the module-relative vaddr of the data segment.
Defined at line 87 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
size_type data_size ()
Exact size of the data segment. This includes whatever file data gives it
a page-aligned starting vaddr, but the total size is not page-aligned.
Space directly after this can be used to lengthen the segment.
Defined at line 102 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
size_type abi_offset ()
Offset into the segment where _ld_abi sits.
Defined at line 105 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
size_type rdebug_offset ()
Offset into the segment where _r_debug sits.
Defined at line 108 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
size_type abi_vaddr ()
Return the module-relative vaddr of _ld_abi.
Defined at line 111 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
size_type rdebug_vaddr ()
Return the module-relative vaddr of _r_debug.
Defined at line 114 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
const TlsdescRuntimeHooks & tlsdesc_runtime ()
Module-relative addresses of the TLSDESC runtime entry points.
Defined at line 117 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
Addr tlsdesc_runtime (TlsdescRuntime hook)
Fetch a particular TLSDESC runtime entry point.
Defined at line 120 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
TlsDescResolver tls_desc_resolver (size_type stub_load_bias)
Return a TLSDESC resolver callable object that can be passed to
elfldltl::MakeSymbolResolver for static TLS layouts. It will use entry
points in the stub dynamic linker acquired by Init, applying the given
load bias for where the stub dynamic linker is to be loaded.
Defined at line 128 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
template <class Diagnostics>
Ptr Create (Diagnostics & diag, RemoteModulePtr ld_stub)
Create() calculates and records all those values by examining the stub
dynamic linker previously decoded. The module pointer is saved for later
use via decoded_module(), below. Note that if the Diagnostics object says
to keep going, this may return with partial information both in the
RemoteAbiStub and in the decoded_module().
Defined at line 138 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h
template <class Diagnostics>
Ptr Create (Diagnostics & diag, zx::vmo ld_stub_vmo, size_type page_size)
This just rolls in RemoteModule::Create with the Create above.
Defined at line 149 of file ../../sdk/lib/ld/include/lib/ld/remote-abi-stub.h