FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_elf Namespace Reference

ELF binary manipulation and reserved space management. More...

Functions

Value< void > copy_binary (fs::path const &path_file_input, fs::path const &path_file_output, std::pair< uint64_t, uint64_t > section)
 Copies the binary data between [offset.first, offset.second] from path_file_input to path_file_output.
 
Value< uint64_t > skip_elf_header (fs::path const &path_file_elf, uint64_t offset=0)
 Skips the elf header starting from 'offset' and returns the offset to the first byte afterwards.
 

Detailed Description

ELF binary manipulation and reserved space management.

Provides utilities for reading and manipulating ELF binaries, including ELF header parsing, binary extraction at specific offsets, and reserved space read/write operations. Essential for FlatImage's embedded configuration storage and binary relocation functionality.

Function Documentation

◆ copy_binary()

Value< void > ns_elf::copy_binary ( fs::path const & path_file_input,
fs::path const & path_file_output,
std::pair< uint64_t, uint64_t > section )
inlinenodiscard

Copies the binary data between [offset.first, offset.second] from path_file_input to path_file_output.

Parameters
path_file_inputThe source file where to read the bytes from
path_file_outputThe target file where to write the bytes to
sectionThe section[start,end] The section to read from the input and write to the output
Returns
Value<void> Nothing on success or the respective error

Definition at line 52 of file elf.hpp.

Here is the caller graph for this function:

◆ skip_elf_header()

Value< uint64_t > ns_elf::skip_elf_header ( fs::path const & path_file_elf,
uint64_t offset = 0 )
inlinenodiscard

Skips the elf header starting from 'offset' and returns the offset to the first byte afterwards.

Parameters
path_file_elfPath to the respective elf file
offsetOffset where the elf section starts
Returns
Value<uint64_t> The offset to the first byte after the ELF header, or the respective error

Definition at line 85 of file elf.hpp.

Here is the caller graph for this function: