16#ifndef LIEF_MACHO_THREAD_LOCAL_VARIABLES_H
17#define LIEF_MACHO_THREAD_LOCAL_VARIABLES_H
102 return pos_ < rhs.pos_;
106 return pos_ - R.pos_;
120 assert(LHS.parent_ == RHS.parent_);
121 return LHS.pos_ == RHS.pos_;
125 return !(LHS == RHS);
129 auto value = parent_->get(pos_);
141 std::unique_ptr<Section>
clone()
const override {
150 return make_range(std::move(B), std::move(E));
Class that represents a Mach-O section.
Definition MachO/Section.hpp:48
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:218
@ THREAD_LOCAL_VARIABLES
Section with thread local variable structure data.
Definition MachO/Section.hpp:110
Random-access iterator that materializes Thunk values on the fly from the raw section content.
Definition ThreadLocalVariables.hpp:85
Thunk operator*() const
Definition ThreadLocalVariables.hpp:128
Iterator(const Iterator &)=default
std::ptrdiff_t operator-(const Iterator &R) const
Definition ThreadLocalVariables.hpp:105
friend bool operator==(const Iterator &LHS, const Iterator &RHS)
Definition ThreadLocalVariables.hpp:119
Iterator & operator=(const Iterator &)=default
Iterator(const ThreadLocalVariables &parent, size_t pos)
Definition ThreadLocalVariables.hpp:89
Iterator & operator+=(std::ptrdiff_t n)
Definition ThreadLocalVariables.hpp:109
Iterator(Iterator &&) noexcept=default
friend bool operator!=(const Iterator &LHS, const Iterator &RHS)
Definition ThreadLocalVariables.hpp:124
Iterator & operator-=(std::ptrdiff_t n)
Definition ThreadLocalVariables.hpp:114
std::unique_ptr< Section > clone() const override
Definition ThreadLocalVariables.hpp:141
friend class Section
Definition ThreadLocalVariables.hpp:48
static bool classof(const Section *section)
Definition ThreadLocalVariables.hpp:170
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:139
optional< Thunk > operator[](size_t idx) const
Access the Thunk at the given idx.
Definition ThreadLocalVariables.hpp:164
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:147
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition iterators.hpp:750
Definition iterators.hpp:603
Definition optional.hpp:23
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace related to the LIEF's Mach-O module.
Definition Abstract/Header.hpp:36
LIEF namespace.
Definition Abstract/Binary.hpp:41
iterator_range< T > make_range(T &&x, T &&y)
Definition iterators.hpp:675
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:68
uint64_t offset
Offset of the variable in the TLS block.
Definition ThreadLocalVariables.hpp:71
uint64_t func
Address of the initializer function (tlv_thunk).
Definition ThreadLocalVariables.hpp:65
std::string to_string() const
friend std::ostream & operator<<(std::ostream &os, const Thunk &thunk)
Definition ThreadLocalVariables.hpp:75
#define LIEF_API
Definition visibility.h:45