LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
ELF/Binary.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_ELF_BINARY_H
17#define LIEF_ELF_BINARY_H
18
19#include <vector>
20#include <memory>
21
22#include "LIEF/visibility.h"
23#include "LIEF/errors.hpp"
24#include "LIEF/iterators.hpp"
25
27
28#include "LIEF/ELF/Note.hpp"
30#include "LIEF/ELF/Header.hpp"
31#include "LIEF/ELF/Section.hpp"
32#include "LIEF/ELF/Segment.hpp"
33#include "LIEF/ELF/Builder.hpp"
34
35namespace LIEF {
37namespace ELF {
38namespace DataHandler {
39class Handler;
40}
41
42class ExeLayout;
43class GnuHash;
44class Layout;
45class ObjectFileLayout;
46class Parser;
47class Relocation;
48class Section;
49class Segment;
50class Symbol;
51class SymbolVersion;
55class SysvHash;
56struct sizing_info_t;
57
60 friend class Parser;
61 friend class Builder;
62 friend class ExeLayout;
63 friend class Layout;
64 friend class ObjectFileLayout;
65
66 public:
67 using string_list_t = std::vector<std::string>;
68
70 using notes_t = std::vector<std::unique_ptr<Note>>;
71
74
77
80 std::vector<std::unique_ptr<SymbolVersionRequirement>>;
81
85
90
93 std::vector<std::unique_ptr<SymbolVersionDefinition>>;
94
98
103
105 using segments_t = std::vector<std::unique_ptr<Segment>>;
106
109
112
114 using dynamic_entries_t = std::vector<std::unique_ptr<DynamicEntry>>;
115
118
122
124 using symbols_version_t = std::vector<std::unique_ptr<SymbolVersion>>;
125
128
132
134 using relocations_t = std::vector<std::unique_ptr<Relocation>>;
135
138
142
146
151
154
158
161
165
167 using symbols_t = std::vector<std::unique_ptr<Symbol>>;
168
171
175
178
182
185
188
191
194
197
200
202 using sections_t = std::vector<std::unique_ptr<Section>>;
203
206
209
210 public:
243
246 enum class SEC_INSERT_POS {
248 AUTO = 0,
249
255 POST_SEGMENT,
256
260 POST_SECTION,
261 };
262
263 public:
264 Binary& operator=(const Binary&) = delete;
265 Binary(const Binary& copy) = delete;
266
269 return type_;
270 }
271
274 return header_;
275 }
276
277 const Header& header() const {
278 return header_;
279 }
280
283 uint64_t last_offset_section() const;
284
287 uint64_t last_offset_segment() const;
288
290 uint64_t next_virtual_address() const;
291
294 return sections_;
295 }
296
298 return sections_;
299 }
300
302 uint64_t entrypoint() const override {
303 return header_.entrypoint();
304 }
305
308 return segments_;
309 }
310
312 return segments_;
313 }
314
317 return dynamic_entries_;
318 }
319
321 return dynamic_entries_;
322 }
323
326
328 Note& add(const Note& note);
329
331 void remove(const DynamicEntry& entry);
332
335
341 void remove(const Section& section, bool clear = false);
342
344 void remove(const Note& note);
345
348
351 void remove(const Segment& seg, bool clear = false);
352
357 void remove(Segment::TYPE type, bool clear = false);
358
362 return dynamic_symbols_;
363 }
364
366 return dynamic_symbols_;
367 }
368
372
376
379 return symtab_symbols_;
380 }
381
383 return symtab_symbols_;
384 }
385
388 return symbol_version_table_;
389 }
391 return symbol_version_table_;
392 }
393
396 return symbol_version_definition_;
397 }
398
400 return symbol_version_definition_;
401 }
402
405 return symbol_version_requirements_;
406 }
407
409 return symbol_version_requirements_;
410 }
411
415
422
428
437 const Section& section);
438
442
446
449 return relocations_;
450 }
451
453 return relocations_;
454 }
455
458 const Relocation* get_relocation(uint64_t address) const;
459 Relocation* get_relocation(uint64_t address) {
460 return const_cast<Relocation*>(
461 static_cast<const Binary*>(this)->get_relocation(address)
462 );
463 }
464
467 const Relocation* get_relocation(const Symbol& symbol) const;
469 return const_cast<Relocation*>(
470 static_cast<const Binary*>(this)->get_relocation(symbol)
471 );
472 }
473
476 const Relocation* get_relocation(const std::string& symbol_name) const;
477 Relocation* get_relocation(const std::string& symbol_name) {
478 return const_cast<Relocation*>(
479 static_cast<const Binary*>(this)->get_relocation(symbol_name)
480 );
481 }
482
486 bool use_gnu_hash() const {
487 return gnu_hash_ != nullptr && has(DynamicEntry::TAG::GNU_HASH);
488 }
489
492 const GnuHash* gnu_hash() const {
493 return use_gnu_hash() ? gnu_hash_.get() : nullptr;
494 }
495
499 bool use_sysv_hash() const {
500 return sysv_hash_ != nullptr && has(DynamicEntry::TAG::HASH);
501 }
502
505 const SysvHash* sysv_hash() const {
506 return use_sysv_hash() ? sysv_hash_.get() : nullptr;
507 }
508
510 bool has_section(const std::string& name) const {
511 return get_section(name) != nullptr;
512 }
513
515 bool has_section_with_offset(uint64_t offset) const;
516
518 bool has_section_with_va(uint64_t va) const;
519
522 Section* get_section(const std::string& name) {
523 return const_cast<Section*>(
524 static_cast<const Binary*>(this)->get_section(name)
525 );
526 }
527 const Section* get_section(const std::string& name) const;
528
532 return get_section(".text");
533 }
534
538
542
546
551 uint64_t imagebase() const override;
552
554 uint64_t virtual_size() const override;
555
558 bool has_interpreter() const;
559
564 const std::string& interpreter() const {
565 return interpreter_;
566 }
567
569 void interpreter(const std::string& interpreter) {
570 interpreter_ = interpreter;
571 }
572
575 return symtab_dyn_symbols();
576 }
577
579 return symtab_dyn_symbols();
580 }
581
583 Symbol& export_symbol(const Symbol& symbol);
584
586 Symbol& export_symbol(const std::string& symbol_name, uint64_t value = 0);
587
590 bool has_dynamic_symbol(const std::string& name) const {
591 return get_dynamic_symbol(name) != nullptr;
592 }
593
596 const Symbol* get_dynamic_symbol(const std::string& name) const;
597
598 Symbol* get_dynamic_symbol(const std::string& name) {
599 return const_cast<Symbol*>(
600 static_cast<const Binary*>(this)->get_dynamic_symbol(name)
601 );
602 }
603
605 bool has_symtab_symbol(const std::string& name) const {
606 return get_symtab_symbol(name) != nullptr;
607 }
608
611 const Symbol* get_symtab_symbol(const std::string& name) const;
612
613 Symbol* get_symtab_symbol(const std::string& name) {
614 return const_cast<Symbol*>(
615 static_cast<const Binary*>(this)->get_symtab_symbol(name)
616 );
617 }
618
622 string_list_t strings(size_t min_size = 5) const;
623
629 void remove_symbol(const std::string& name);
630
632 void remove_symtab_symbol(const std::string& name);
634
636 void remove_dynamic_symbol(const std::string& name);
637
644
647 get_function_address(const std::string& func_name) const override;
648
650 //
653 result<uint64_t> get_function_address(const std::string& func_name,
654 bool demangled) const;
655
667 Section* add(const Section& section, bool loaded = true,
669
670 Section* extend(const Section& section, uint64_t size);
671
674
677 const SymbolVersion* version = nullptr);
678
680 Symbol& add_exported_function(uint64_t address, const std::string& name = "");
681
683 DynamicEntryLibrary& add_library(const std::string& library_name);
684
686 void remove_library(const std::string& library_name);
687
690 DynamicEntryLibrary* get_library(const std::string& library_name) {
691 return const_cast<DynamicEntryLibrary*>(
692 static_cast<const Binary*>(this)->get_library(library_name)
693 );
694 }
695
698 const DynamicEntryLibrary* get_library(const std::string& library_name) const;
699
701 bool has_library(const std::string& name) const {
702 return get_library(name) != nullptr;
703 }
704
712 Segment* add(const Segment& segment, uint64_t base = 0);
713
718 Segment* replace(const Segment& new_segment, const Segment& original_segment,
719 uint64_t base = 0);
720
721 Segment* extend(const Segment& segment, uint64_t size);
722
723
730 void patch_address(uint64_t address, const std::vector<uint8_t>& patch_value,
731 LIEF::Binary::VA_TYPES addr_type =
733
734
743 uint64_t address, uint64_t patch_value, size_t size = sizeof(uint64_t),
745 ) override;
746
751 void patch_pltgot(const Symbol& symbol, uint64_t address);
752
753
758 void patch_pltgot(const std::string& symbol_name, uint64_t address);
759
761 void strip();
762
767 void remove_section(const std::string& name, bool clear = false) override;
768
775 void write(const std::string& filename) {
776 return write(filename, Builder::config_t{});
777 }
778
787 void write(const std::string& filename, const Builder::config_t& config);
788
795 void write(std::ostream& os) {
796 return write(os, Builder::config_t{});
797 }
798
804 void write(std::ostream& os, const Builder::config_t& config);
805
807 std::vector<uint8_t> raw();
808
810 result<uint64_t> virtual_address_to_offset(uint64_t virtual_address) const;
811
818 uint64_t slide = 0) const override;
819
824 bool is_pie() const override;
825
827 bool has_nx() const override;
828
831 int64_t dynsym_idx(const std::string& name) const;
832
833 int64_t dynsym_idx(const Symbol& sym) const;
834
836 int64_t symtab_idx(const std::string& name) const;
837
838 int64_t symtab_idx(const Symbol& sym) const;
839
846 const Section* section_from_offset(uint64_t offset,
847 bool skip_nobits = true) const;
848 Section* section_from_offset(uint64_t offset, bool skip_nobits = true) {
849 return const_cast<Section*>(
850 static_cast<const Binary*>(this)->section_from_offset(offset, skip_nobits)
851 );
852 }
853
859 const Section* section_from_virtual_address(uint64_t address,
860 bool skip_nobits = true) const;
862 bool skip_nobits = true) {
863 return const_cast<Section*>(
864 static_cast<const Binary*>(this)->section_from_virtual_address(address,
865 skip_nobits)
866 );
867 }
868
871 const Segment* segment_from_virtual_address(uint64_t address) const;
873 return const_cast<Segment*>(
874 static_cast<const Binary*>(this)->segment_from_virtual_address(address)
875 );
876 }
877
878
880 uint64_t address) const;
882 return const_cast<Segment*>(
883 static_cast<const Binary*>(this)->segment_from_virtual_address(type,
884 address)
885 );
886 }
887
890 const Segment* segment_from_offset(uint64_t offset) const;
891 Segment* segment_from_offset(uint64_t offset) {
892 return const_cast<Segment*>(
893 static_cast<const Binary*>(this)->segment_from_offset(offset)
894 );
895 }
896
901 return const_cast<DynamicEntry*>(static_cast<const Binary*>(this)->get(tag));
902 }
903
908 return const_cast<Segment*>(static_cast<const Binary*>(this)->get(type));
909 }
910
913 const Note* get(Note::TYPE type) const;
915 return const_cast<Note*>(static_cast<const Binary*>(this)->get(type));
916 }
917
922 return const_cast<Section*>(static_cast<const Binary*>(this)->get(type));
923 }
924
926 bool has(DynamicEntry::TAG tag) const {
927 return get(tag) != nullptr;
928 }
929
931 bool has(Segment::TYPE type) const {
932 return get(type) != nullptr;
933 }
934
936 bool has(Note::TYPE type) const {
937 return get(type) != nullptr;
938 }
939
941 bool has(Section::TYPE type) const {
942 return get(type) != nullptr;
943 }
944
947 uint64_t virtual_address, uint64_t size,
949 ) const override;
950
952 void accept(LIEF::Visitor& visitor) const override;
953
955 void permute_dynamic_symbols(const std::vector<size_t>& permutation);
956
960
964
967
969 bool has_notes() const;
970
975 return notes_;
976 }
977
979 return notes_;
980 }
981
984 uint64_t eof_offset() const;
985
987 bool has_overlay() const {
988 return !overlay_.empty();
989 }
990
993 return overlay_;
994 }
995
997 void overlay(std::vector<uint8_t> overlay) {
998 overlay_ = std::move(overlay);
999 }
1000
1010
1013 std::vector<uint64_t> get_relocated_dynamic_array(DynamicEntry::TAG tag) const;
1014
1017
1020 auto it = std::find_if(sections_.begin(), sections_.end(),
1021 [&section](const std::unique_ptr<Section>& S) {
1022 return S.get() == &section;
1023 });
1024 if (it == sections_.end()) {
1026 }
1027 return std::distance(sections_.begin(), it);
1028 }
1029
1031 result<size_t> get_section_idx(const std::string& name) const {
1032 auto it = std::find_if(sections_.begin(), sections_.end(),
1033 [name](const std::unique_ptr<Section>& S) {
1034 return S->name() == name;
1035 });
1036 if (it == sections_.end()) {
1038 }
1039 return std::distance(sections_.begin(), it);
1040 }
1041
1045 find_version_requirement(const std::string& libname) const;
1046
1048 return const_cast<SymbolVersionRequirement*>(
1049 static_cast<const Binary*>(this)->find_version_requirement(name)
1050 );
1051 }
1052
1059 bool remove_version_requirement(const std::string& libname);
1060
1061 uint8_t ptr_size() const {
1062 switch (type()) {
1063 case Header::CLASS::ELF32: return sizeof(uint32_t);
1064 case Header::CLASS::ELF64: return sizeof(uint64_t);
1065 default: return 0;
1066 }
1067 return 0;
1068 }
1069
1070 uint64_t page_size() const override;
1071
1072 static bool classof(const LIEF::Binary* bin) {
1073 return bin->format() == Binary::FORMATS::ELF ||
1074 bin->format() == Binary::FORMATS::OAT;
1075 }
1076
1077 size_t hash(const std::string& name);
1078
1079 ~Binary() override;
1080
1081 std::ostream& print(std::ostream& os) const override;
1082
1084 add(entry);
1085 return *this;
1086 }
1087 Binary& operator+=(const Section& section) {
1088 add(section);
1089 return *this;
1090 }
1091
1092 Binary& operator+=(const Segment& segment) {
1093 add(segment);
1094 return *this;
1095 }
1096
1097 Binary& operator+=(const Note& note) {
1098 add(note);
1099 return *this;
1100 }
1101
1103 remove(entry);
1104 return *this;
1105 }
1106
1108 remove(tag);
1109 return *this;
1110 }
1111
1112 Binary& operator-=(const Note& note) {
1113 remove(note);
1114 return *this;
1115 }
1116
1118 remove(type);
1119 return *this;
1120 }
1121
1123 return get(type);
1124 }
1125
1127 return get(type);
1128 }
1129
1131 return get(tag);
1132 }
1133
1135 return get(tag);
1136 }
1137
1139 return get(type);
1140 }
1141
1143 return get(type);
1144 }
1145
1147 return get(type);
1148 }
1149
1151 return get(type);
1152 }
1153
1154 bool should_swap() const {
1155 return should_swap_;
1156 }
1157
1158 protected:
1159 struct phdr_relocation_info_t {
1160 uint64_t new_offset = 0;
1161 size_t nb_segments = 0;
1162 void clear() {
1163 new_offset = 0;
1164 nb_segments = 0;
1165 }
1166 };
1167 LIEF_LOCAL Binary();
1168
1170 LIEF_LOCAL LIEF::Binary::sections_t get_abstract_sections() override;
1171
1172 LIEF_LOCAL LIEF::Header get_abstract_header() const override {
1173 return LIEF::Header::from(*this);
1174 }
1175
1177 get_abstract_exported_functions() const override;
1179 get_abstract_imported_functions() const override;
1180 LIEF_LOCAL std::vector<std::string>
1181 get_abstract_imported_libraries() const override;
1182 LIEF_LOCAL LIEF::Binary::symbols_t get_abstract_symbols() override;
1183 LIEF_LOCAL LIEF::Binary::relocations_t get_abstract_relocations() override;
1184
1185 template<ELF::ARCH ARCH>
1186 LIEF_LOCAL void patch_relocations(uint64_t from, uint64_t shift);
1187
1188 template<class T>
1189 LIEF_LOCAL void patch_addend(Relocation& relocatio, uint64_t from,
1190 uint64_t shift);
1191
1192 LIEF_LOCAL void shift_sections(uint64_t from, uint64_t shift);
1193 LIEF_LOCAL void shift_segments(uint64_t from, uint64_t shift);
1194 LIEF_LOCAL void shift_dynamic_entries(uint64_t from, uint64_t shift);
1195 LIEF_LOCAL void shift_symbols(uint64_t from, uint64_t shift);
1196 LIEF_LOCAL void shift_relocations(uint64_t from, uint64_t shift);
1197
1198 template<class ELF_T>
1199 LIEF_LOCAL void fix_got_entries(uint64_t from, uint64_t shift);
1200
1201 LIEF_LOCAL LIEF::Binary::functions_t eh_frame_functions() const;
1202 LIEF_LOCAL LIEF::Binary::functions_t armexid_functions() const;
1203
1204 template<Header::FILE_TYPE OBJECT_TYPE, bool note = false>
1205 LIEF_LOCAL Segment* add_segment(const Segment& segment, uint64_t base);
1206
1207 LIEF_LOCAL uint64_t relocate_phdr_table_auto();
1208 LIEF_LOCAL uint64_t relocate_phdr_table_pie();
1209 LIEF_LOCAL uint64_t relocate_phdr_table_v1();
1210 LIEF_LOCAL uint64_t relocate_phdr_table_v2();
1211 LIEF_LOCAL uint64_t relocate_phdr_table_v3();
1212
1213 template<Segment::TYPE PT>
1214 LIEF_LOCAL Segment* extend_segment(const Segment& segment, uint64_t size);
1215
1216 template<bool LOADED>
1217 LIEF_LOCAL Section* add_section(const Section& section, SEC_INSERT_POS pos);
1218
1219 std::vector<Symbol*> symtab_dyn_symbols() const;
1220
1221 LIEF_LOCAL std::string shstrtab_name() const;
1222 LIEF_LOCAL Section* add_frame_section(const Section& sec);
1223 LIEF_LOCAL Section* add_section(std::unique_ptr<Section> sec);
1224
1225 LIEF_LOCAL LIEF::Binary::functions_t tor_functions(DynamicEntry::TAG tag) const;
1226
1227 Header::CLASS type_ = Header::CLASS::NONE;
1228 Header header_;
1229 sections_t sections_;
1230 segments_t segments_;
1231 dynamic_entries_t dynamic_entries_;
1232 symbols_t dynamic_symbols_;
1233 symbols_t symtab_symbols_;
1234 relocations_t relocations_;
1235 symbols_version_t symbol_version_table_;
1236 symbols_version_requirement_t symbol_version_requirements_;
1237 symbols_version_definition_t symbol_version_definition_;
1238 notes_t notes_;
1239 std::unique_ptr<GnuHash> gnu_hash_;
1240 std::unique_ptr<SysvHash> sysv_hash_;
1241 std::unique_ptr<DataHandler::Handler> datahandler_;
1242 phdr_relocation_info_t phdr_reloc_info_;
1243
1244 std::string interpreter_;
1245 std::vector<uint8_t> overlay_;
1246 std::unique_ptr<sizing_info_t> sizing_info_;
1247 uint64_t pagesize_ = 0;
1248 bool should_swap_ = false;
1249};
1250
1251}
1252}
1253#endif
Generic interface representing a binary executable.
Definition Abstract/Binary.hpp:59
std::vector< Function > functions_t
Definition Abstract/Binary.hpp:82
@ ELF
Definition Abstract/Binary.hpp:76
@ OAT
Definition Abstract/Binary.hpp:79
FORMATS format() const
Executable format (ELF, PE, Mach-O) of the underlying binary.
Definition Abstract/Binary.hpp:124
std::vector< Symbol * > symbols_t
Internal container.
Definition Abstract/Binary.hpp:94
VA_TYPES
Enumeration of virtual address types used for patching and memory access.
Definition Abstract/Binary.hpp:62
@ AUTO
Automatically determine if the address is absolute or relative (default behavior).
Definition Abstract/Binary.hpp:65
std::vector< Section * > sections_t
Internal container.
Definition Abstract/Binary.hpp:85
std::vector< Relocation * > relocations_t
Internal container.
Definition Abstract/Binary.hpp:103
friend class ObjectFileLayout
Definition ELF/Binary.hpp:64
const_ref_iterator< std::vector< Symbol * > > it_const_symbols
Iterator which outputs static and dynamic const Symbol& object.
Definition ELF/Binary.hpp:187
~Binary() override
Segment * add(const Segment &segment, uint64_t base=0)
Add a new segment in the binary.
bool use_gnu_hash() const
true if GNU hash is used
Definition ELF/Binary.hpp:486
std::vector< std::unique_ptr< SymbolVersionRequirement > > symbols_version_requirement_t
Internal container for storing SymbolVersionRequirement.
Definition ELF/Binary.hpp:79
const DynamicEntry * get(DynamicEntry::TAG tag) const
Return the first ELF::DynamicEntry associated with the given tag If the tag can't be found,...
void remove(const Segment &seg, bool clear=false)
Remove the given segment. If clear is set, the original content of the segment will be filled with ze...
void write(std::ostream &os, const Builder::config_t &config)
Reconstruct the binary object with the given config and write it in os stream.
Header::CLASS type() const
Return binary's class (ELF32 or ELF64).
Definition ELF/Binary.hpp:268
std::vector< std::unique_ptr< Symbol > > symbols_t
Internal container for storing ELF's Symbol.
Definition ELF/Binary.hpp:167
const_ref_iterator< const sections_t &, const Section * > it_const_sections
Iterator which outputs const Section& object.
Definition ELF/Binary.hpp:208
bool should_swap() const
Definition ELF/Binary.hpp:1154
result< uint64_t > virtual_address_to_offset(uint64_t virtual_address) const
Convert a virtual address to a file offset.
it_const_symbols symbols() const
Definition ELF/Binary.hpp:578
uint64_t last_offset_section() const
Return the last offset used in binary according to sections table.
SEC_INSERT_POS
This enum defines where the content of a newly added section should be inserted.
Definition ELF/Binary.hpp:246
@ AUTO
Defer the choice to LIEF.
Definition ELF/Binary.hpp:248
span< const uint8_t > get_content_from_virtual_address(uint64_t virtual_address, uint64_t size, Binary::VA_TYPES addr_type=Binary::VA_TYPES::AUTO) const override
Return the content located at virtual address.
PHDR_RELOC
Definition ELF/Binary.hpp:214
@ PIE_SHIFT
Definition ELF/Binary.hpp:225
@ AUTO
Definition ELF/Binary.hpp:218
@ BSS_END
Definition ELF/Binary.hpp:231
@ BINARY_END
Definition ELF/Binary.hpp:235
@ SEGMENT_GAP
Definition ELF/Binary.hpp:241
Header & header()
Return Elf header .
Definition ELF/Binary.hpp:273
friend class ExeLayout
Definition ELF/Binary.hpp:62
const Section * section_from_offset(uint64_t offset, bool skip_nobits=true) const
Return the ELF::Section from the given offset. Return a nullptr if a section can't be found.
it_dynamic_entries dynamic_entries()
Return binary's dynamic entries.
Definition ELF/Binary.hpp:316
it_symbols_version_requirement symbols_version_requirement()
Return Symbol version requirement.
Definition ELF/Binary.hpp:404
void remove(Segment::TYPE type, bool clear=false)
Remove all segments associated with the given type.
size_t hash(const std::string &name)
it_const_dynamic_relocations dynamic_relocations() const
it_pltgot_relocations pltgot_relocations()
Return plt.got relocations.
ref_iterator< notes_t &, Note * > it_notes
Iterator which outputs Note& object.
Definition ELF/Binary.hpp:73
filter_iterator< relocations_t &, Relocation * > it_object_relocations
Iterator which outputs Relocation& object found in object files (.o).
Definition ELF/Binary.hpp:153
void strip()
Strip the binary by removing symtab symbols.
Note & add(const Note &note)
Add the given note and return the created entry.
Symbol & export_symbol(const std::string &symbol_name, uint64_t value=0)
Export the symbol with the given name and create it if it doesn't exist.
void remove_symtab_symbol(Symbol *symbol)
Binary & operator+=(const DynamicEntry &entry)
Definition ELF/Binary.hpp:1083
void remove(const Note &note)
Remove the given note.
const Note * operator[](Note::TYPE type) const
Definition ELF/Binary.hpp:1142
std::vector< std::unique_ptr< Relocation > > relocations_t
Internal container for storing ELF's Relocation.
Definition ELF/Binary.hpp:134
void write(const std::string &filename, const Builder::config_t &config)
Reconstruct the binary object with the given config and write it in filename.
bool has_notes() const
true if the binary embeds notes
int64_t dynsym_idx(const std::string &name) const
Symbol index in the dynamic symbol table or -1 if the symbol does not exist.
Segment * segment_from_virtual_address(uint64_t address)
Definition ELF/Binary.hpp:872
const_ref_iterator< const symbols_t &, const Symbol * > it_const_symtab_symbols
Iterator which outputs the static/debug const Symbol& object.
Definition ELF/Binary.hpp:180
const Relocation * get_relocation(const Symbol &symbol) const
Return relocation associated with the given Symbol It returns a nullptr if it is not found.
void remove_dynamic_symbol(const std::string &name)
Remove dynamic symbols with the given name.
Binary & operator-=(const Note &note)
Definition ELF/Binary.hpp:1112
const Section * section_from_virtual_address(uint64_t address, bool skip_nobits=true) const
Return the ELF::Section from the given address. Return a nullptr if a section can't be found.
const Relocation * get_relocation(const std::string &symbol_name) const
Return relocation associated with the given Symbol name It returns a nullptr if it is not found.
ref_iterator< symbols_version_definition_t &, SymbolVersionDefinition * > it_symbols_version_definition
Iterator which outputs SymbolVersionDefinition& object.
Definition ELF/Binary.hpp:96
it_symtab_symbols symtab_symbols()
Return the debug symbols from the .symtab section.
Definition ELF/Binary.hpp:378
LIEF::Binary::functions_t ctor_functions() const override
List of binary constructors (typically, the functions located in the .init_array).
uint64_t imagebase() const override
Return program image base. For instance 0x40000.
LIEF::Binary::functions_t functions() const
List of the functions found the in the binary.
bool has_library(const std::string &name) const
Check if the given library name exists in the current binary.
Definition ELF/Binary.hpp:701
int64_t dynsym_idx(const Symbol &sym) const
LIEF::Binary::functions_t dtor_functions() const
List of the binary destructors (typically, the functions located in the .fini_array).
std::vector< std::unique_ptr< SymbolVersion > > symbols_version_t
Internal container for storing ELF's SymbolVersion.
Definition ELF/Binary.hpp:124
Segment * operator[](Segment::TYPE type)
Definition ELF/Binary.hpp:1122
const Symbol * get_dynamic_symbol(const std::string &name) const
Get the dynamic symbol from the given name. Return a nullptr if it can't be found.
Relocation * get_relocation(uint64_t address)
Definition ELF/Binary.hpp:459
const Segment * segment_from_virtual_address(Segment::TYPE type, uint64_t address) const
DynamicEntryLibrary * get_library(const std::string &library_name)
Get the library object (DynamicEntryLibrary) from the given name If the library can't be found,...
Definition ELF/Binary.hpp:690
bool is_pie() const override
Check if the binary has been compiled with -fpie -pie flags.
Symbol * get_symtab_symbol(const std::string &name)
Definition ELF/Binary.hpp:613
it_symbols_version symbols_version()
Return the symbol versions.
Definition ELF/Binary.hpp:387
DynamicEntryLibrary & add_library(const std::string &library_name)
Add a library as dependency.
Section * text_section()
Return the .text section. If the section can't be found, it returns a nullptr.
Definition ELF/Binary.hpp:531
filter_iterator< std::vector< Symbol * > > it_exported_symbols
Iterator which outputs exported Symbol& object.
Definition ELF/Binary.hpp:190
it_object_relocations object_relocations()
Return relocations used in an object file (*.o).
Section * get_section(const std::string &name)
Return Section with the given name. If the section can't be found, it returns a nullptr.
Definition ELF/Binary.hpp:522
it_imported_symbols imported_symbols()
Return symbols which are imported by the binary.
std::vector< std::unique_ptr< Segment > > segments_t
Internal container for storing ELF's Segment.
Definition ELF/Binary.hpp:105
it_sections sections()
Return an iterator over the binary's sections.
Definition ELF/Binary.hpp:293
it_const_notes notes() const
Return an iterator over the ELF's LIEF::ELF::Note.
Definition ELF/Binary.hpp:974
void patch_address(uint64_t address, uint64_t patch_value, size_t size=sizeof(uint64_t), LIEF::Binary::VA_TYPES addr_type=LIEF::Binary::VA_TYPES::AUTO) override
Patch the address with the given value.
it_symbols_version_definition symbols_version_definition()
Return symbols version definition.
Definition ELF/Binary.hpp:395
it_const_object_relocations object_relocations() const
const Symbol * get_symtab_symbol(const std::string &name) const
Get the symtab symbol from the given name Return a nullptr if it can't be found.
it_dynamic_relocations dynamic_relocations()
Return dynamic relocations.
void overlay(std::vector< uint8_t > overlay)
Function to set the overlay.
Definition ELF/Binary.hpp:997
Note * get(Note::TYPE type)
Definition ELF/Binary.hpp:914
void remove_dynamic_symbol(Symbol *symbol)
Remove the given symbol from the dynamic symbols table.
const_ref_iterator< const symbols_t &, const Symbol * > it_const_dynamic_symbols
Iterator which outputs the Dynamic const Symbol& object.
Definition ELF/Binary.hpp:173
span< const uint8_t > overlay() const
Overlay data (if any).
Definition ELF/Binary.hpp:992
const_ref_iterator< const symbols_version_definition_t &, const SymbolVersionDefinition * > it_const_symbols_version_definition
Iterator which outputs const SymbolVersionDefinition& object.
Definition ELF/Binary.hpp:100
bool has_overlay() const
True if data are present at the end of the binary.
Definition ELF/Binary.hpp:987
const_ref_iterator< const dynamic_entries_t &, const DynamicEntry * > it_const_dynamic_entries
Iterator which outputs const DynamicEntry& object.
Definition ELF/Binary.hpp:120
bool has(Section::TYPE type) const
Check if a ELF::Section associated with the given type exists.
Definition ELF/Binary.hpp:941
std::ostream & print(std::ostream &os) const override
Relocation * get_relocation(const std::string &symbol_name)
Definition ELF/Binary.hpp:477
Symbol & add_dynamic_symbol(const Symbol &symbol, const SymbolVersion *version=nullptr)
Add a dynamic symbol with the associated SymbolVersion.
ref_iterator< segments_t &, Segment * > it_segments
Iterator which outputs Segment& object.
Definition ELF/Binary.hpp:108
std::vector< std::unique_ptr< DynamicEntry > > dynamic_entries_t
Internal container for storing ELF's DynamicEntry.
Definition ELF/Binary.hpp:114
Symbol & add_symtab_symbol(const Symbol &symbol)
Add a symtab symbol.
Binary & operator+=(const Section &section)
Definition ELF/Binary.hpp:1087
const Section * get_section(const std::string &name) const
void interpreter(const std::string &interpreter)
Change the interpreter.
Definition ELF/Binary.hpp:569
const_filter_iterator< std::vector< Symbol * > > it_const_imported_symbols
Iterator which outputs imported const Symbol& object.
Definition ELF/Binary.hpp:199
Binary(const Binary &copy)=delete
const_filter_iterator< const relocations_t &, const Relocation * > it_const_dynamic_relocations
Iterator which outputs dynamic const Relocation& object (not related to the PLT/GOT mechanism).
Definition ELF/Binary.hpp:149
int64_t symtab_idx(const Symbol &sym) const
const Segment * operator[](Segment::TYPE type) const
Definition ELF/Binary.hpp:1126
it_const_sections sections() const
Definition ELF/Binary.hpp:297
result< size_t > get_section_idx(const std::string &name) const
Find the index of the section with the name given in the first parameter.
Definition ELF/Binary.hpp:1031
Relocation * add_object_relocation(const Relocation &relocation, const Section &section)
Add relocation for object file (.o).
it_exported_symbols exported_symbols()
Return symbols which are exported by the binary.
const_ref_iterator< const relocations_t &, const Relocation * > it_const_relocations
Iterator which outputs const Relocation& object.
Definition ELF/Binary.hpp:163
const Header & header() const
Definition ELF/Binary.hpp:277
std::vector< std::string > string_list_t
Definition ELF/Binary.hpp:67
it_const_symtab_symbols symtab_symbols() const
Definition ELF/Binary.hpp:382
result< size_t > get_section_idx(const Section &section) const
Find the index of the section given in the first parameter.
Definition ELF/Binary.hpp:1019
Section * extend(const Section &section, uint64_t size)
std::vector< std::unique_ptr< Note > > notes_t
Internal container for storing notes.
Definition ELF/Binary.hpp:70
const Segment * get(Segment::TYPE type) const
Return the first ELF::Segment associated with the given type. If a segment can't be found,...
uint64_t entrypoint() const override
Return the binary's entrypoint.
Definition ELF/Binary.hpp:302
void write(const std::string &filename)
Reconstruct the binary object and write it in filename.
Definition ELF/Binary.hpp:775
friend class Builder
Definition ELF/Binary.hpp:61
bool has(Note::TYPE type) const
Check if a ELF::Note associated with the given type exists.
Definition ELF/Binary.hpp:936
Segment * segment_from_offset(uint64_t offset)
Definition ELF/Binary.hpp:891
bool has_symtab_symbol(const std::string &name) const
Check if the symbol with the given name exists in the symtab symbol table.
Definition ELF/Binary.hpp:605
bool has_dynamic_symbol(const std::string &name) const
Check if the symbol with the given name exists in the dynamic symbols table.
Definition ELF/Binary.hpp:590
DynamicEntry * operator[](DynamicEntry::TAG tag)
Definition ELF/Binary.hpp:1130
result< uint64_t > offset_to_virtual_address(uint64_t offset, uint64_t slide=0) const override
Convert the given offset into a virtual address.
ref_iterator< symbols_t &, Symbol * > it_symtab_symbols
Iterator which outputs the static/debug Symbol& object.
Definition ELF/Binary.hpp:177
const SymbolVersionRequirement * find_version_requirement(const std::string &libname) const
Try to find the SymbolVersionRequirement associated with the given library name (e....
it_const_symbols_version_definition symbols_version_definition() const
Definition ELF/Binary.hpp:399
const Section * get(Section::TYPE type) const
Return the first ELF::Section associated with the given type If a section can't be found,...
Section * hash_section()
Return the hash section. If the section can't be found, it returns a nullptr.
uint64_t next_virtual_address() const
Return the next virtual address available.
it_const_exported_symbols exported_symbols() const
const Segment * segment_from_virtual_address(uint64_t address) const
Return the ELF::Segment from the given address. Return a nullptr if a segment can't be found.
Binary & operator-=(const DynamicEntry &entry)
Definition ELF/Binary.hpp:1102
uint64_t eof_offset() const
Return the last offset used by the ELF binary according to both: the sections table and the segments ...
void remove(DynamicEntry::TAG tag)
Remove all dynamic entries with the given tag.
uint64_t page_size() const override
Get the default memory page size according to the architecture and the format of the current binary.
it_segments segments()
Return binary's segments.
Definition ELF/Binary.hpp:307
void remove_library(const std::string &library_name)
Remove the given library from the dependencies.
result< uint64_t > get_function_address(const std::string &func_name, bool demangled) const
Return the address of the given function name.
it_dynamic_symbols dynamic_symbols()
Return an iterator over the binary's dynamic symbols The dynamic symbols are those located in the ....
Definition ELF/Binary.hpp:361
filter_iterator< std::vector< Symbol * > > it_imported_symbols
Iterator which outputs imported Symbol& object.
Definition ELF/Binary.hpp:196
const_filter_iterator< const relocations_t &, const Relocation * > it_const_object_relocations
Iterator which outputs const Relocation& object found in object files (.o).
Definition ELF/Binary.hpp:156
it_const_dynamic_entries dynamic_entries() const
Definition ELF/Binary.hpp:320
void remove_symtab_symbol(const std::string &name)
Remove symtabl symbols with the given name.
Binary & operator-=(DynamicEntry::TAG tag)
Definition ELF/Binary.hpp:1107
it_relocations relocations()
Return all relocations present in the binary.
Definition ELF/Binary.hpp:448
Section * dynamic_section()
Return the .dynamic section. If the section can't be found, it returns a nullptr.
Segment * get(Segment::TYPE type)
Definition ELF/Binary.hpp:907
const DynamicEntryLibrary * get_library(const std::string &library_name) const
Get the library object (DynamicEntryLibrary) from the given name If the library can't be found,...
uint8_t ptr_size() const
Definition ELF/Binary.hpp:1061
const DynamicEntry * operator[](DynamicEntry::TAG tag) const
Definition ELF/Binary.hpp:1134
it_symbols symbols()
Return an iterator on both static and dynamic symbols.
Definition ELF/Binary.hpp:574
uint64_t relocate_phdr_table(PHDR_RELOC type)
Force relocating the segments table in a specific way.
std::vector< std::unique_ptr< Section > > sections_t
Internal container for storing ELF's Section.
Definition ELF/Binary.hpp:202
const_ref_iterator< const segments_t &, const Segment * > it_const_segments
Iterator which outputs const Segment& object.
Definition ELF/Binary.hpp:111
Segment * replace(const Segment &new_segment, const Segment &original_segment, uint64_t base=0)
Replace the segment given in 2nd parameter with the segment given in the first one and return the upd...
void remove(const Section &section, bool clear=false)
Remove the given section. The clear parameter can be used to zeroize the original content beforehand.
Symbol * get_dynamic_symbol(const std::string &name)
Definition ELF/Binary.hpp:598
Section * operator[](Section::TYPE type)
Definition ELF/Binary.hpp:1146
it_const_dynamic_symbols dynamic_symbols() const
Definition ELF/Binary.hpp:365
uint64_t virtual_size() const override
Return the size of the mapped binary.
bool has_section_with_offset(uint64_t offset) const
Check if a section that handles the given offset exists.
string_list_t strings(size_t min_size=5) const
Return list of the strings used by the ELF binary.
void remove_section(const std::string &name, bool clear=false) override
Remove a binary's section.
friend class Parser
Definition ELF/Binary.hpp:60
std::vector< uint8_t > raw()
Reconstruct the binary object and return its content as a byte vector.
const SysvHash * sysv_hash() const
Return the SysvHash object as a read-only object If the ELF binary does not use the legacy sysv hash ...
Definition ELF/Binary.hpp:505
SymbolVersionRequirement * find_version_requirement(const std::string &name)
Definition ELF/Binary.hpp:1047
bool has_section(const std::string &name) const
Check if a section with the given name exists in the binary.
Definition ELF/Binary.hpp:510
Relocation * get_relocation(const Symbol &symbol)
Definition ELF/Binary.hpp:468
Section * section_from_offset(uint64_t offset, bool skip_nobits=true)
Definition ELF/Binary.hpp:848
Section * get(Section::TYPE type)
Definition ELF/Binary.hpp:921
static bool classof(const LIEF::Binary *bin)
Definition ELF/Binary.hpp:1072
it_const_relocations relocations() const
Definition ELF/Binary.hpp:452
Binary & operator-=(Note::TYPE type)
Definition ELF/Binary.hpp:1117
Symbol & add_exported_function(uint64_t address, const std::string &name="")
Create a symbol for the function at the given address and export it.
bool is_targeting_android() const
True if the current ELF is targeting Android.
it_const_segments segments() const
Definition ELF/Binary.hpp:311
DynamicEntry * get(DynamicEntry::TAG tag)
Definition ELF/Binary.hpp:900
Section * symtab_symbols_section()
Return section which holds the symtab symbols. If the section can't be found, it returns a nullptr.
uint64_t last_offset_segment() const
Return the last offset used in binary according to segments table.
bool use_sysv_hash() const
true if SYSV hash is used
Definition ELF/Binary.hpp:499
friend class Layout
Definition ELF/Binary.hpp:63
ref_iterator< sections_t &, Section * > it_sections
Iterator which outputs Section& object.
Definition ELF/Binary.hpp:205
void patch_pltgot(const Symbol &symbol, uint64_t address)
Patch the imported symbol with the address.
const_filter_iterator< const relocations_t &, const Relocation * > it_const_pltgot_relocations
Iterator which outputs plt/got const Relocation& object.
Definition ELF/Binary.hpp:140
filter_iterator< relocations_t &, Relocation * > it_dynamic_relocations
Iterator which outputs dynamic Relocation& object (not related to the PLT/GOT mechanism).
Definition ELF/Binary.hpp:145
ref_iterator< relocations_t &, Relocation * > it_relocations
Iterator which outputs Relocation& object.
Definition ELF/Binary.hpp:160
bool has_interpreter() const
Check if the binary uses a loader (also named linker or interpreter).
const Relocation * get_relocation(uint64_t address) const
Return relocation associated with the given address. It returns a nullptr if it is not found.
void remove_symbol(const std::string &name)
Remove symbols with the given name in both:
const Section * operator[](Section::TYPE type) const
Definition ELF/Binary.hpp:1150
const Segment * segment_from_offset(uint64_t offset) const
Return the ELF::Segment from the offset. Return a nullptr if a segment can't be found.
Section * section_from_virtual_address(uint64_t address, bool skip_nobits=true)
Definition ELF/Binary.hpp:861
void remove(Note::TYPE type)
Remove all notes with the given type.
Relocation & add_dynamic_relocation(const Relocation &relocation)
Add a new dynamic relocation.
ref_iterator< symbols_t &, Symbol * > it_dynamic_symbols
Iterator which outputs the Dynamic Symbol& object.
Definition ELF/Binary.hpp:170
const std::string & interpreter() const
Return the ELF interpreter if any. (e.g. /lib64/ld-linux-x86-64.so.2) If the binary does not have an ...
Definition ELF/Binary.hpp:564
int64_t symtab_idx(const std::string &name) const
Symbol index from the .symtab section or -1 if the symbol is not present.
Segment * extend(const Segment &segment, uint64_t size)
bool remove_version_requirement(const std::string &libname)
Deletes all required symbol versions linked to the specified library name. The function returns true ...
std::vector< uint64_t > get_relocated_dynamic_array(DynamicEntry::TAG tag) const
Return the array defined by the given tag (e.g. DynamicEntry::TAG::INIT_ARRAY) with relocations appli...
it_const_pltgot_relocations pltgot_relocations() const
it_const_symbols_version_requirement symbols_version_requirement() const
Definition ELF/Binary.hpp:408
ref_iterator< std::vector< Symbol * > > it_symbols
Iterator which outputs static and dynamic Symbol& object.
Definition ELF/Binary.hpp:184
it_notes notes()
Definition ELF/Binary.hpp:978
std::vector< std::unique_ptr< SymbolVersionDefinition > > symbols_version_definition_t
Internal container for storing SymbolVersionDefinition.
Definition ELF/Binary.hpp:92
it_const_imported_symbols imported_symbols() const
ref_iterator< symbols_version_t &, SymbolVersion * > it_symbols_version
Iterator which outputs SymbolVersion& object.
Definition ELF/Binary.hpp:127
void patch_address(uint64_t address, const std::vector< uint8_t > &patch_value, LIEF::Binary::VA_TYPES addr_type=LIEF::Binary::VA_TYPES::AUTO) override
Patch the content at virtual address address with patch_value.
Note * operator[](Note::TYPE type)
Definition ELF/Binary.hpp:1138
const_filter_iterator< std::vector< Symbol * > > it_const_exported_symbols
Iterator which outputs exported const Symbol& object.
Definition ELF/Binary.hpp:193
Binary & operator+=(const Segment &segment)
Definition ELF/Binary.hpp:1092
Binary & operator=(const Binary &)=delete
filter_iterator< relocations_t &, Relocation * > it_pltgot_relocations
Iterator which outputs plt/got Relocation& object.
Definition ELF/Binary.hpp:137
Section * add(const Section &section, bool loaded=true, SEC_INSERT_POS pos=SEC_INSERT_POS::AUTO)
Add a new section in the binary.
Segment * segment_from_virtual_address(Segment::TYPE type, uint64_t address)
Definition ELF/Binary.hpp:881
void permute_dynamic_symbols(const std::vector< size_t > &permutation)
Apply the given permutation on the dynamic symbols table.
const_ref_iterator< const symbols_version_t &, const SymbolVersion * > it_const_symbols_version
Iterator which outputs const SymbolVersion& object.
Definition ELF/Binary.hpp:130
bool has_section_with_va(uint64_t va) const
Check if a section that handles the given virtual address exists.
const_ref_iterator< const notes_t &, const Note * > it_const_notes
Iterator which outputs const Note& object.
Definition ELF/Binary.hpp:76
void patch_pltgot(const std::string &symbol_name, uint64_t address)
Patch the imported symbol's name with the address.
void accept(LIEF::Visitor &visitor) const override
Method associated with the visitor pattern.
const Note * get(Note::TYPE type) const
Return the first ELF::Note associated with the given type If a note can't be found,...
ref_iterator< dynamic_entries_t &, DynamicEntry * > it_dynamic_entries
Iterator which outputs DynamicEntry& object.
Definition ELF/Binary.hpp:117
Symbol & export_symbol(const Symbol &symbol)
Export the given symbol and create it if it doesn't exist.
it_const_symbols_version symbols_version() const
Definition ELF/Binary.hpp:390
Relocation & add_pltgot_relocation(const Relocation &relocation)
Add a .plt.got relocation. This kind of relocation is usually associated with a PLT stub that aims at...
Binary & operator+=(const Note &note)
Definition ELF/Binary.hpp:1097
result< uint64_t > get_function_address(const std::string &func_name) const override
Return the address of the given function name.
const GnuHash * gnu_hash() const
Return the GnuHash object in readonly If the ELF binary does not use the GNU hash table,...
Definition ELF/Binary.hpp:492
void write(std::ostream &os)
Reconstruct the binary object and write it in os stream.
Definition ELF/Binary.hpp:795
ref_iterator< symbols_version_requirement_t &, SymbolVersionRequirement * > it_symbols_version_requirement
Iterator which outputs SymbolVersionRequirement& object.
Definition ELF/Binary.hpp:83
bool has_nx() const override
Check if the binary uses the NX protection (Non executable stack).
const_ref_iterator< const symbols_version_requirement_t &, const SymbolVersionRequirement * > it_const_symbols_version_requirement
Iterator which outputs const SymbolVersionRequirement& object.
Definition ELF/Binary.hpp:87
void remove(const DynamicEntry &entry)
Remove the given dynamic entry.
DynamicEntry & add(const DynamicEntry &entry)
Add the given dynamic entry and return the new entry.
bool has(Segment::TYPE type) const
Check if ELF::Segment associated with the given type exists.
Definition ELF/Binary.hpp:931
bool has(DynamicEntry::TAG tag) const
Check if an ELF::DynamicEntry associated with the given tag exists.
Definition ELF/Binary.hpp:926
Class which represents a DT_NEEDED entry in the dynamic table.
Definition DynamicEntryLibrary.hpp:29
Class which represents an entry in the dynamic table These entries are located in the ....
Definition DynamicEntry.hpp:37
TAG
Definition DynamicEntry.hpp:48
@ HASH
Definition DynamicEntry.hpp:54
@ GNU_HASH
Definition DynamicEntry.hpp:89
Class which provides a view over the GNU Hash implementation. Most of the fields are read-only since ...
Definition GnuHash.hpp:40
Class which represents the ELF's header. This class mirrors the raw ELF Elfxx_Ehdr structure.
Definition ELF/Header.hpp:35
CLASS
Match the result of Elfxx_Ehdr.e_ident[EI_CLASS].
Definition ELF/Header.hpp:74
@ ELF64
32-bit objects
Definition ELF/Header.hpp:77
@ ELF32
Invalid class.
Definition ELF/Header.hpp:76
Class which represents an ELF note. This class can be instantiated using the static Note::create func...
Definition Note.hpp:39
TYPE
LIEF representation of the ELF NT_ values.
Definition Note.hpp:49
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:45
Class that represents an ELF relocation.
Definition ELF/Relocation.hpp:40
Class which represents an ELF Section.
Definition ELF/Section.hpp:48
TYPE
Definition ELF/Section.hpp:62
Class which represents the ELF segments.
Definition Segment.hpp:48
TYPE
Definition Segment.hpp:72
Class which represents an entry defined in DT_VERDEF or .gnu.version_d.
Definition SymbolVersionDefinition.hpp:38
Class which represents an entry in the DT_VERNEED or .gnu.version_r table.
Definition SymbolVersionRequirement.hpp:40
Class which represents an entry defined in the DT_VERSYM dynamic entry.
Definition SymbolVersion.hpp:33
Class which represents an ELF symbol.
Definition ELF/Symbol.hpp:35
Class which represents the SYSV hash for the symbols resolution.
Definition SysvHash.hpp:39
Definition Abstract/Header.hpp:40
static Header from(const LIEF::ELF::Binary &elf)
Definition Visitor.hpp:212
Iterator which return a ref on container's values given predicates.
Definition iterators.hpp:293
Iterator which returns reference on container's values.
Definition iterators.hpp:45
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:77
@ not_found
Definition errors.hpp:26
tl::unexpected< lief_errors > make_error_code(lief_errors e)
Create an standard error code from lief_errors.
Definition errors.hpp:53
Definition ELF/Binary.hpp:38
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:40
filter_iterator< CT, U, typename decay_t< CT >::const_iterator > const_filter_iterator
Iterator which return a const ref on container's values given predicates.
Definition iterators.hpp:559
tcb::span< ElementType, Extent > span
Definition span.hpp:22
lief_version_t version()
Return the current version.
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which return const ref on container's values.
Definition iterators.hpp:286
Configuration options to tweak the building process.
Definition ELF/Builder.hpp:55
#define LIEF_API
Definition visibility.h:43
#define LIEF_LOCAL
Definition visibility.h:44