16#ifndef LIEF_MACHO_THREAD_LOCAL_VARIABLES_H
17#define LIEF_MACHO_THREAD_LOCAL_VARIABLES_H
96 return pos_ < rhs.pos_;
100 return pos_ - R.pos_;
114 assert(LHS.parent_ == RHS.parent_);
115 return LHS.pos_ == RHS.pos_;
119 return !(LHS == RHS);
123 auto value = parent_->get(pos_);
135 std::unique_ptr<Section>
clone()
const override {
144 return make_range(std::move(B), std::move(E));
Class that represents a Mach-O section.
Definition MachO/Section.hpp:47
Section(const details::section_32 &sec)
TYPE type() const
Type of the section. This value can help to determine the purpose of the section (e....
Definition MachO/Section.hpp:217
@ THREAD_LOCAL_VARIABLES
Section with thread local variable structure data.
Definition MachO/Section.hpp:109
Random-access iterator that materializes Thunk values on the fly from the raw section content.
Definition ThreadLocalVariables.hpp:79
Thunk operator*() const
Definition ThreadLocalVariables.hpp:122
Iterator(const Iterator &)=default
std::ptrdiff_t operator-(const Iterator &R) const
Definition ThreadLocalVariables.hpp:99
friend bool operator==(const Iterator &LHS, const Iterator &RHS)
Definition ThreadLocalVariables.hpp:113
Iterator & operator=(const Iterator &)=default
Iterator(const ThreadLocalVariables &parent, size_t pos)
Definition ThreadLocalVariables.hpp:83
Iterator & operator+=(std::ptrdiff_t n)
Definition ThreadLocalVariables.hpp:103
Iterator(Iterator &&) noexcept=default
friend bool operator!=(const Iterator &LHS, const Iterator &RHS)
Definition ThreadLocalVariables.hpp:118
Iterator & operator-=(std::ptrdiff_t n)
Definition ThreadLocalVariables.hpp:108
std::unique_ptr< Section > clone() const override
Definition ThreadLocalVariables.hpp:135
friend class Section
Definition ThreadLocalVariables.hpp:48
static bool classof(const Section *section)
Definition ThreadLocalVariables.hpp:164
optional< Thunk > get(size_t idx) const
Access the Thunk at the given idx, or return an empty optional if the index is out of range.
iterator_range< Iterator > thunks_it
Definition ThreadLocalVariables.hpp:133
optional< Thunk > operator[](size_t idx) const
Access the Thunk at the given idx.
Definition ThreadLocalVariables.hpp:158
ThreadLocalVariables(const ThreadLocalVariables &)=default
size_t nb_thunks() const
Number of Thunk descriptors in this section.
ThreadLocalVariables(ThreadLocalVariables &&) noexcept=default
void set(size_t idx, const Thunk &thunk)
Change the Thunk at the given idx.
~ThreadLocalVariables() override=default
thunks_it thunks() const
Return an iterator range over the Thunk descriptors stored in this section.
Definition ThreadLocalVariables.hpp:141
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition iterators.hpp:685
Definition iterators.hpp:567
Definition optional.hpp:23
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
LIEF namespace.
Definition Abstract/Binary.hpp:40
iterator_range< T > make_range(T &&x, T &&y)
Definition iterators.hpp:620
Descriptor for a single thread-local variable.
Definition ThreadLocalVariables.hpp:63
uint64_t key
pthread_key_t key used by the runtime
Definition ThreadLocalVariables.hpp:65
uint64_t offset
Offset of the variable in the TLS block.
Definition ThreadLocalVariables.hpp:66
uint64_t func
Address of the initializer function (tlv_thunk).
Definition ThreadLocalVariables.hpp:64
std::string to_string() const
friend std::ostream & operator<<(std::ostream &os, const Thunk &thunk)
Definition ThreadLocalVariables.hpp:69
#define LIEF_API
Definition visibility.h:43