Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Under what circumstances, if any, would an executable ELF file (type == EXEC) not have section headers?

Tags:

elf

Reading the ELF specification, it seems that for an EXEC type ELF file, the section header table is listed as "optional". Under what circumstances would it be omitted?

like image 796
Michael Stachowsky Avatar asked Dec 06 '25 10:12

Michael Stachowsky


1 Answers

Under what circumstances would it be omitted?

Section info is not needed at execution time, and traditionally is only kept for debugging (e.g. you can get a backtrace for a crash from an executable compiled without any debugging info).

You should be able to remove them with e.g. strip --strip-all, but that doesn't appear to work.

You could also binary-patch the the file -- e.g. zero out .e_shoff and .e_shnum in the ELF header.

Related answer.

like image 57
Employed Russian Avatar answered Dec 09 '25 15:12

Employed Russian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!