template <ElfApi Elf = Elf<>, AbiPtrTraitsApi<const typename Elf::Addr, Elf> AbiTraits = LocalAbiTraits>
struct InitFiniInfo
Defined at line 126 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
The object itself is a very small and cheaply-copied container (a span plus
another word) with stable ABI (see
<lib
/elfldltl/abi-ptr.h> for details).
Public Members
static const bool kLocal
Public Methods
void InitFiniInfo<Elf, AbiTraits> ()
Defined at line 138 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
void InitFiniInfo<Elf, AbiTraits> (const InitFiniInfo<Elf, AbiTraits> & )
Defined at line 139 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
void InitFiniInfo<Elf, AbiTraits> (Array array)
InitFiniInfo can be default-constructed and then set_* called, or it can
be explicitly constructed from an array with no legacy singleton.
Defined at line 143 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
void InitFiniInfo<Elf, AbiTraits> (Array array)
InitFiniInfo can be default-constructed and then set_* called, or it can
be explicitly constructed from an array with no legacy singleton.
Defined at line 143 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
void InitFiniInfo<Elf, AbiTraits> (Array array)
InitFiniInfo can be default-constructed and then set_* called, or it can
be explicitly constructed from an array with no legacy singleton.
Defined at line 143 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
void InitFiniInfo<Elf, AbiTraits> (Array array)
InitFiniInfo can be default-constructed and then set_* called, or it can
be explicitly constructed from an array with no legacy singleton.
Defined at line 143 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
void InitFiniInfo<Elf, AbiTraits> (Array array)
InitFiniInfo can be default-constructed and then set_* called, or it can
be explicitly constructed from an array with no legacy singleton.
Defined at line 143 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & operator= (const InitFiniInfo<Elf, AbiTraits> & )
Defined at line 149 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
Array array ()
An array of function pointers, in the .init_array or .fini_array section,
which is normally part of the RELRO segment. So the pointers here are
unrelocated in the file, but dynamic relocation records apply simple
fixup. As this points directly into the load image in the Memory object,
if that image is being relocated in place, then these values will be
absolute function pointers after relocation. If the original file data
(or the load image before relocation) is being read, the these addresses
need the load bias added.
Defined at line 159 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
std::optional<Addr> legacy ()
A single function pointer, from the legacy DT_INIT or DT_FINI entry. This
is not contiguous with the array and is stored separately in the ELF
headers where no relocation records apply. So this address always needs
the load bias added to yield a runtime function pointer.
Defined at line 165 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & set_array (Array array)
Defined at line 172 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & set_array (Array array)
Defined at line 172 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & set_array (Array array)
Defined at line 172 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & set_array (Array array)
Defined at line 172 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & set_array (Array array)
Defined at line 172 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniInfo<Elf, AbiTraits> & set_legacy (Addr legacy)
Defined at line 177 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
Array::size_type size ()
Return the number of function pointers present.
Defined at line 183 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
bool empty ()
Defined at line 185 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniRawRangeApi<Addr> auto raw_init (bool relocated)
Return a range of {address, bool} pairs for initializer functions to call;
the bool in each pair says whether the load bias has already been applied.
Defined at line 199 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniRawRangeApi<Addr> auto raw_fini (bool relocated)
The same, but reversed for finalizer calls.
Defined at line 212 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniRangeApi<size_type> auto init (size_type bias, bool relocated)
Return a range of addresses, all with the bias applied. If the relocated
flag is true, then DT_INIT_ARRAY / DT_FINI_ARRAY elements already have the
bias applied (but a legacy DT_INIT / DT_FINI may still need it).
Defined at line 221 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniRangeApi<size_type> auto fini (size_type bias, bool relocated)
The same, but reversed for finalizer calls.
Defined at line 228 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
template <typename F = InitFiniFunction>
InitFiniCallableApi<F> auto callable_init (size_type bias, bool relocated)
Like init(), but each address taken as the F* function pointer type. The
return object is both a range of pointer values (InitFiniRangeApi
<F
*>) and
can itself be called with the same arguments as F to call each in turn.
Defined at line 239 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
template <typename F = InitFiniFunction>
InitFiniCallableApi<F> auto callable_fini (size_type bias, bool relocated)
The same, but reversed for finalizer calls.
Defined at line 247 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniRangeApi<size_type> auto init_no_legacy ()
The load bias is moot when relocated and no legacy DT_INIT / DT_FINI can
be set. These no-argument versions must only be used when it's a known
invariant that legacy() would definitely return std::nullopt. They are
provided in case environments with such invariants find it convenient not
to plumb through the load bias at all.
Defined at line 258 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
InitFiniRangeApi<size_type> auto fini_no_legacy ()
Defined at line 265 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
template <typename F = InitFiniFunction>
InitFiniCallableApi<F> auto callable_init_no_legacy ()
Defined at line 274 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h
template <typename F = InitFiniFunction>
InitFiniCallableApi<F> auto callable_fini_no_legacy ()
Defined at line 280 of file ../../src/lib/elfldltl/include/lib/elfldltl/init-fini.h