LCOV - code coverage report
Current view: top level - src/elf - builder.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 98.0 % 49 48
Test Date: 2025-01-11:00:00:00 Functions: 66.7 % 3 2

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : /// Structure used to configure the [`crate::elf::Binary::write_with_config`] operation
       4            0 : #[derive(Debug)]
       5              : pub struct Config {
       6              :     /// Rebuild `DT_HASH`
       7              :     pub dt_hash: bool,
       8              : 
       9              :     /// Rebuild `DT_STRTAB`
      10              :     pub dyn_str: bool,
      11              : 
      12              :     /// Rebuild `PT_DYNAMIC` segment
      13              :     pub dynamic_section: bool,
      14              : 
      15              :     /// Rebuild `DT_FINI_ARRAY`
      16              :     pub fini_array: bool,
      17              : 
      18              :     /// Rebuild `DT_GNU_HASH`
      19              :     pub gnu_hash: bool,
      20              : 
      21              :     /// Rebuild `DT_INIT_ARRAY`
      22              :     pub init_array: bool,
      23              : 
      24              :     /// Rebuild `PT_INTERPRETER`
      25              :     pub interpreter: bool,
      26              : 
      27              :     /// Rebuild `DT_JMPREL`
      28              :     pub jmprel: bool,
      29              : 
      30              :     /// Rebuild notes sections
      31              :     pub notes: bool,
      32              : 
      33              :     /// Rebuild `DT_PREINIT_ARRAY`
      34              :     pub preinit_array: bool,
      35              : 
      36              :     /// Rebuild `DT_RELR`
      37              :     pub relr: bool,
      38              : 
      39              :     /// Rebuild `DT_ANDROID_REL[A]`
      40              :     pub android_rela: bool,
      41              : 
      42              :     /// Rebuild `DT_REL[A]`
      43              :     pub rela: bool,
      44              : 
      45              :     /// Rebuild `.symtab`
      46              :     pub static_symtab: bool,
      47              : 
      48              :     /// Rebuild `DT_VERDEF`
      49              :     pub sym_verdef: bool,
      50              : 
      51              :     /// Rebuild `DT_VERNEED`
      52              :     pub sym_verneed: bool,
      53              : 
      54              :     /// Rebuild `DT_VERSYM`
      55              :     pub sym_versym: bool,
      56              : 
      57              :     /// Rebuild `DT_SYMTAB`
      58              :     pub symtab: bool,
      59              : 
      60              :     /// Rebuild the Coredump notes
      61              :     pub coredump_notes: bool,
      62              : 
      63              :     /// Force to relocating all the ELF structures that are supported by LIEF (mostly for testing)
      64              :     pub force_relocate: bool,
      65              : }
      66              : 
      67              : impl Default for Config {
      68           10 :     fn default() -> Config {
      69           10 :         Config {
      70           10 :             dt_hash: true,
      71           10 :             dyn_str: true,
      72           10 :             dynamic_section: true,
      73           10 :             fini_array: true,
      74           10 :             gnu_hash: true,
      75           10 :             init_array: true,
      76           10 :             interpreter: true,
      77           10 :             jmprel: true,
      78           10 :             notes: false,
      79           10 :             preinit_array: true,
      80           10 :             relr: true,
      81           10 :             android_rela: true,
      82           10 :             rela: true,
      83           10 :             static_symtab: true,
      84           10 :             sym_verdef: true,
      85           10 :             sym_verneed: true,
      86           10 :             sym_versym: true,
      87           10 :             symtab: true,
      88           10 :             coredump_notes: true,
      89           10 :             force_relocate: false,
      90           10 :         }
      91           10 :     }
      92              : }
      93              : 
      94              : impl Config {
      95              :     #[doc(hidden)]
      96           10 :     pub fn to_ffi(&self) -> ffi::ELF_Binary_write_config_t {
      97           10 :         ffi::ELF_Binary_write_config_t {
      98           10 :             dt_hash: self.dt_hash,
      99           10 :             dyn_str: self.dyn_str,
     100           10 :             dynamic_section: self.dynamic_section,
     101           10 :             fini_array: self.fini_array,
     102           10 :             gnu_hash: self.gnu_hash,
     103           10 :             init_array: self.init_array,
     104           10 :             interpreter: self.interpreter,
     105           10 :             jmprel: self.jmprel,
     106           10 :             notes: self.notes,
     107           10 :             preinit_array: self.preinit_array,
     108           10 :             relr: self.relr,
     109           10 :             android_rela: self.android_rela,
     110           10 :             rela: self.rela,
     111           10 :             static_symtab: self.static_symtab,
     112           10 :             sym_verdef: self.sym_verdef,
     113           10 :             sym_verneed: self.sym_verneed,
     114           10 :             sym_versym: self.sym_versym,
     115           10 :             symtab: self.symtab,
     116           10 :             coredump_notes: self.coredump_notes,
     117           10 :             force_relocate: self.force_relocate,
     118           10 :         }
     119           10 :     }
     120              : }
     121              : 
     122              : 
        

Generated by: LCOV version 2.1-1