Line data Source code
1 : //! Module for the ELF file format support in LIEF.
2 : //!
3 : //! The [`Binary`] structure exposes the main API to inspect an ELF file. It can be instantiated,
4 : //! using either: [`crate::elf::parse`], [`crate::elf::Binary::parse`] or [`crate::Binary::parse`]
5 : //!
6 : //! ```
7 : //! let elf = lief::elf::parse("/bin/ls").unwrap();
8 : //! for section in elf.sections() {
9 : //! println!("section: {}", section.name());
10 : //! }
11 : //! ```
12 :
13 : pub mod binary;
14 : pub mod builder;
15 : pub mod dynamic;
16 : pub mod hash;
17 : pub mod header;
18 : pub mod note;
19 : pub mod relocation;
20 : pub mod section;
21 : pub mod segment;
22 : pub mod symbol;
23 : pub mod symbol_versioning;
24 : pub mod parser_config;
25 :
26 : #[doc(inline)]
27 : pub use binary::Binary;
28 :
29 : #[doc(inline)]
30 : pub use header::Header;
31 :
32 : #[doc(inline)]
33 : pub use section::Section;
34 :
35 : #[doc(inline)]
36 : pub use segment::Segment;
37 :
38 : #[doc(inline)]
39 : pub use symbol::Symbol;
40 :
41 : #[doc(inline)]
42 : pub use hash::Sysv as SysvHash;
43 :
44 : #[doc(inline)]
45 : pub use hash::Gnu as GnuHash;
46 :
47 : #[doc(inline)]
48 : pub use note::Notes;
49 :
50 : #[doc(inline)]
51 : pub use dynamic::Entries as DynamicEntries;
52 :
53 : #[doc(inline)]
54 : pub use relocation::Relocation;
55 :
56 : #[doc(inline)]
57 : pub use symbol_versioning::{
58 : SymbolVersion, SymbolVersionAux, SymbolVersionAuxRequirement, SymbolVersionDefinition,
59 : SymbolVersionRequirement,
60 : };
61 :
62 : #[doc(inline)]
63 : pub use parser_config::Config as ParserConfig;
64 :
65 : /// Parse an ELF file from the given file path
66 0 : pub fn parse(path: &str) -> Option<Binary> {
67 0 : Binary::parse(path)
68 0 : }
69 :
70 : /// Parse an ELF file from the given file path and configuration
71 0 : pub fn parse_with_config(path: &str, config: &ParserConfig) -> Option<Binary> {
72 0 : Binary::parse_with_config(path, config)
73 0 : }
|