ElfEditor.addSegment

uint addSegment(uint type, uint flags, uint[] sections, ulong alignment = 0x1000)

Add a segment (program header) to the ELF file.

Parameters

typeThe segment type (PT_LOAD, PT_DYNAMIC, etc.).
flagsThe segment flags (PF_R, PF_W, PF_X).
sectionsAn array of section indices to include in this segment.
alignThe segment alignment (default: 0x1000).

Returns

The segment index.