elfedit - Linux


elfedit is a versatile tool for modifying the information stored in ELF (Executable and Linkable Format) binary files. It allows users to edit various sections of ELF files, such as program headers, sections, symbols, and relocations.


elfedit [options] <filepath>


  • -a, –add-segment <segment_name> <executable_file> <file_offset> <file_size>: Adds a new segment to the file
  • -c, –change-attribute <attribute_name> <attribute_value>: Changes an attribute of the file
  • -d, –delete-section <section_name>: Deletes a section from the file
  • -e, –edit-symbol <symbol_name> <new_value> <symbol_type>: Edits the value of a symbol
  • -h, –help: Displays help information
  • -i, –info: Prints information about the file
  • -l, –list-sections: Lists all sections in the file
  • -p, –print-relocations: Prints relocation entries for a section
  • -r, –add-relocation <section_name> : Adds a relocation entry to a section
  • -t, –change-type <section_name> <new_type>: Changes the type of a section


  • Add a new segment with name "custom_segment" at file offset 0x1000 with size 0x100:
elfedit -a custom_segment executable.elf 0x1000 0x100
  • Change the value of the symbol "main" to 0x8000:
elfedit -e main 0x8000 FUNC
  • Delete the section ".comment":
elfedit -d .comment executable.elf

Common Issues

  • Permission Denied: Ensure you have appropriate permissions to modify the ELF file.
  • Invalid Section Name: Verify the existence of the section you are attempting to modify.
  • Relocation Overflow: Check if your relocation offset and addend values fit within the bounds of the section.


elfedit can be combined with other tools for advanced tasks:

  • objdump -h executable.elf | elfedit -i: Display ELF header information
  • readelf -x executable.elf | elfedit -l: List sections and their attributes

Related Commands

  • readelf
  • objdump