48 static constexpr uint32_t NB_MAX_SYMBOLS = 1000000;
49 static constexpr uint32_t DELTA_NB_SYMBOLS = 3000;
50 static constexpr uint32_t NB_MAX_BUCKETS = NB_MAX_SYMBOLS;
51 static constexpr uint32_t NB_MAX_CHAINS = 1000000;
52 static constexpr uint32_t NB_MAX_SEGMENTS = 10000;
53 static constexpr uint32_t NB_MAX_RELOCATIONS = 3000000;
54 static constexpr uint32_t NB_MAX_DYNAMIC_ENTRIES = 1000;
55 static constexpr uint32_t NB_MAX_MASKWORD = 512;
56 static constexpr uint32_t MAX_SEGMENT_SIZE = 3_GB;
71 static std::unique_ptr<Binary>
parse(
const std::string& file,
82 static std::unique_ptr<Binary>
parse(
const std::vector<uint8_t>& data,
93 static std::unique_ptr<Binary>
parse(std::unique_ptr<BinaryStream> stream,
109 bool should_swap()
const;
113 void link_symbol_version();
117 template<
typename ELF_T>
120 template<
typename ELF_T>
123 template<
typename ELF_T>
126 template<
typename ELF_T>
129 uint64_t get_dynamic_string_table()
const;
133 uint64_t get_dynamic_string_table_from_sections()
const;
136 template<
typename ELF_T>
140 template<
typename ELF_T>
144 template<
typename ELF_T>
148 template<
typename ELF_T>
152 template<
typename ELF_T>
156 template<
typename ELF_T>
159 template<
typename ELF_T>
160 ok_error_t parse_dynamic_entries(uint64_t offset, uint64_t size);
162 template<
typename ELF_T>
163 ok_error_t parse_dynamic_symbols(uint64_t offset);
173 template<
typename ELF_T>
174 ok_error_t parse_symtab_symbols(uint64_t offset, uint32_t nb_symbols,
175 const Section& string_section);
180 template<
typename ELF_T,
typename REL_T>
181 ok_error_t parse_dynamic_relocations(uint64_t relocations_offset, uint64_t size);
188 template<
typename ELF_T,
typename REL_T>
189 ok_error_t parse_pltgot_relocations(uint64_t offset, uint64_t size);
193 template<
typename ELF_T>
194 ok_error_t parse_relative_relocations(uint64_t offset, uint64_t size);
197 template<
typename ELF_T>
198 ok_error_t parse_packed_relocations(uint64_t offset, uint64_t size);
200 template<
typename ELF_T>
205 template<
typename ELF_T,
typename REL_T>
213 template<
typename ELF_T>
214 ok_error_t parse_symbol_version_requirement(uint64_t offset, uint32_t nb_entries);
222 template<
typename ELF_T>
223 ok_error_t parse_symbol_version_definition(uint64_t offset, uint32_t nb_entries);
232 ok_error_t parse_symbol_version(uint64_t symbol_version_offset);
237 template<
typename ELF_T>
238 ok_error_t parse_symbol_gnu_hash(uint64_t offset);
241 ok_error_t parse_notes(uint64_t offset, uint64_t size);
243 std::unique_ptr<Note> get_note(uint32_t type, std::string name, std::vector<uint8_t> desc_bytes);
246 ok_error_t parse_symbol_sysv_hash(uint64_t offset);
250 template<
typename ELF_T,
typename REL_T>
251 uint32_t max_relocation_index(uint64_t relocations_offset, uint64_t size)
const;
254 static bool check_section_in_segment(
const Section& section,
const Segment& segment);
258 std::unique_ptr<BinaryStream> stream_;
259 std::unique_ptr<Binary> binary_;
268 std::unordered_map<size_t, Section*> sections_idx_;
static std::unique_ptr< Binary > parse(std::unique_ptr< BinaryStream > stream, const ParserConfig &conf=ParserConfig::all())
Parse the ELF binary from the given stream and return a LIEF::ELF::Binary object.
result< ok_t > ok_error_t
Opaque structure that is used by LIEF to avoid writing result<void> f(...). Instead,...
Definition errors.hpp:108